<strong> vs. font-weight:bold & <em> vs. font-style:italic
Is there any real difference between using <strong>
and <em>
instead of the CSS properties:
font-weight: bold;
font-style: italic;
Also, what is really the reason that both options exist? I could be wrong but didn't <strong>
and <em>
came on the scene quite a while after font-weight
and font-style
became standard CSS properties? If so, there must be some reason for them.
HTML represents meaning; CSS represents appearance. How you mark up text in a document is not determined by how that text appears on screen, but simply what it means. As another example, some other HTML elements, like headings, are styled font-weight: bold
by default, but they are marked up using <h1>
–<h6>
, not <strong>
or <b>
.
In HTML5, you use <strong>
to indicate important parts of a sentence, for example:
<p><strong>Do not touch.</strong> Contains <strong>hazardous</strong> materials.
And you use <em>
to indicate linguistic stress, for example:
<p>A Gentleman: I suppose he does. But there's no point in asking.
<p>A Lady: Why not?
<p>A Gentleman: Because he doesn't row.
<p>A Lady: He doesn't <em>row</em>?
<p>A Gentleman: No. He <em>doesn't</em> row.
<p>A Lady: Ah. I see what you mean.
These elements are semantic elements that just happen to have bold and italic representations by default, but you can style them however you like. For example, in the <em>
sample above (dialogue from the opening scene of BioShock Infinite), you could represent stress emphasis in uppercase instead of italics, but the functional purpose of the <em>
element remains the same — to change the context of a sentence by emphasizing specific words or phrases over others:
em {
font-style: normal;
text-transform: uppercase;
}
em {
font-style: normal;
text-transform: uppercase;
}
p {
line-height: 1.5;
margin: 0;
}
<p>A Gentleman: I suppose he does. But there's no point in asking.
<p>A Lady: Why not?
<p>A Gentleman: Because he doesn't row.
<p>A Lady: He doesn't <em>row</em>?
<p>A Gentleman: No. He <em>doesn't</em> row.
<p>A Lady: Ah. I see what you mean.
Note that the original answer from 2011 (below) applied to HTML standards prior to HTML5, in which <strong>
and <em>
had somewhat different meanings, <b>
and <i>
were purely presentational and had no semantic meaning whatsoever. Like <strong>
and <em>
respectively, they have similar presentational defaults but may be styled differently.
You use <strong>
and <em>
to indicate intense emphasis and normal emphasis respectively.
Or think of it this way: font-weight: bold
is closer to <b>
than <strong>
, and font-style: italic
is closer to <i>
than <em>
. These visual styles are purely visual: tools like screen readers aren't going to understand what bold and italic mean, but some screen readers are able to read <strong>
and <em>
text in a more emphasized tone.
The <em>
element - from W3C (HTML5 reference)
YES! There is a clear difference.
The <em>
element represents stress emphasis of its contents. The level of emphasis that a particular piece of content has is given by its number of ancestor <em>
elements.
<strong> = important content
<em> = stress emphasis of its contents
The placement of emphasis changes the meaning of the sentence. The element thus forms an integral part of the content. The precise way in which emphasis is used in this way depends on the language.
Note!
The
<em>
element also isnt intended to convey importance; for that purpose, the<strong>
element is more appropriate.The
<em>
element isn't a generic "italics" element. Sometimes, text is intended to stand out from the rest of the paragraph, as if it was in a different mood or voice. For this, thei
element is more appropriate.
Reference (examples): See W3C Reference