why does italics need an element?
HTML is a markup language, so some of the elements which you come across are used to style (or markup) the content in some way or other. You can make text bold with <b>
or italicise text with <i>
for instance.
In accessibility terms, it means that screen readers etc can more easily interpret what they’re seeing, as opposed to styling text for emphasis/importance in CSS.
There are also other options:
Also, it doesn’t.
p {
font-style: italic;
}
The <i>
element is an old element and just like the <b>
is from before CSS was what it is now. We didn’t initially have a clear separation of concerns so we have a bunch of old HTML element that does visual non-semantic stuff, including layout element like <center>
. The semantic versions of the two elements are <em>
and <strong>
.
thanks guys, makes complete sense now and gave me some broad objectice insight. appreciate it!
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.