CSS integrated into an HTML5 tag

These HTML tags are all well and good, but where do we put them?

You can integrate CSS directly into HTML5 tags to be much faster. For very simple pages, you don't need to create a separate .CSS stylesheet. If it's just to apply a single line of style to a tag, you don't need to put the CSS in the HTML document โ€” you can integrate it directly onto a tag.

Keep in mind that this solution exists but should be reserved for occasional use, for example to define a style on a single element that only appears on one page of your site.

Example:

<h1 style="font-style: bold;">Titre de l'article 1</h1>

<h1>Titre de l'article 2</h1>

In this example, you use two level 1 headings. They will both be displayed larger than the rest of your page text. However, the first one will be bold while the second will only use the default style, so it will not be bold.

This style should therefore be used with caution, as the text may not follow the style of your site. And above all, this type of coding does not allow you to easily update the presentation of your site. Use this technique for small pages or for very specific cases.

Let's do another example:

<body>
...
<div style="background-image:url(images/fond.jpg); border-color: #849460; border-style:solid;
border-width: 2px; border-radius: 10px; width:300px; margin:auto; text-align:left; padding-left:80px;">
Contenu de votre รฉlรฉment
</div>
...
</body>

In any case, it is best to identify the relevant tags using names in order to apply distinct rules to them. We will see this with internal stylesheets.

Recent Posts

Recent Comments

"

Itamde is also an online programming school.

Itamde

Learn what you want, at your own pace

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You may also be interested in...

The essential SEO plugins for WordPress

The essential SEO plugins for WordPress

The SEO plugins that actually matter for WordPress โ€” SEO suite, cache, images, redirects โ€” and how to combine them without slowing your site.

Pointers in C and C++ explained simply

Pointers in C and C++ explained simply

Understand pointers in C and C++ without the stress: memory addresses, dynamic allocation, common pitfalls and good habits, explained step by step.

Stay up to date with the latest news and developments

Access restricted content

Discover behind-the-scenes details of our projects, exclusive resources, and the progress of our creations in real time.

Sign up for our newsletter

Receive our news, creative insights, and updates from the studio directly in your inbox.

Follow us

Join our community on social media to follow our daily projects and interact with us.