Is it ok to add css styles to semantic elements like
<article style="font-size:1.2em; color:#ccc>text text </article>
or will this get me into trouble and should I use
<div style="font-size:1.2em; color:#ccc>
<article>text text </article>
</div>
It is much better to use classes rather than hard-coding styles into your HTML. This allows separation of content from presentation, and makes it much easier to make changes. So I would recommend something like
.article {
font-size:1.2em;
color:#ccc;
}
and
<article class="article">text text </article>
Yes, as long as its an HTML/HTML5 tag, you can definitely add classes or styles to semantic HTML elements.
You can refer below links for a list of new semantic elements in HTML5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With