What\'s the difference between and
,
and
in HTML/XHTML? When should you use
In HTML Lang, these two tags are used as follows:
simple text this is test text normal text
simple text this is important textwith normal text
The major diversity between these two HTML tags is that bold makes text only visually look bold, while strong also symbolism hit the respective text as essential and indicates that it is a clear word or text section.
This difference is due to the fact that HTML code differentiates between symbolism and physical visual html tags. While the earlier refer to the meaning of the relevant areas, the latter merely define the optical display in browsers. You can check this from here
<em>
and <strong>
consume more bandwidth than <i>
and <b>
.
They also require more typing (if not auto-generated).
They also clutter the editor screen with more text. I seem to recall that programmers like smaller source files if they are the same. (And let's be real, they are the same. Yes, there are "technical" (<i>cough</i>, ahem, excuse me) differences, but that's mostly phony to begin with.)
With any of the above tags, you can use style sheets to customize how they appear to however you want if you need them to appear different than their defaults renderings.
<b>
and <i>
are both related to style, whereas <em>
and <strong>
are semantic. In HTML 4, the first are classified as font style elements, and the latter as phrase elements.
As you indicated correctly, <i>
and <em>
are often considered similar, because browsers often render both in italics. But according to the specifications, <em>
indicates emphasis and <strong>
indicates stronger emphasis, which is quite clear, but often misinterpreted. On the other hand, the distinction between when to use <i>
or <b>
is really a matter of style.
HTML Formatting Elements:
HTML also defines special elements for defining text with a special meaning. HTML uses elements like <b> and <i> for formatting output, like bold or italic text.
HTML Bold and Strong Formatting:
The HTML <b> element defines bold text, without any extra importance.
<b>This text is bold</b>
The HTML <strong> element defines strong text, with added semantic "strong" importance.
<strong>This text is strong</strong>
HTML Italic and Emphasized Formatting:
The HTML <i> element defines italic text, without any extra importance.
<i>This text is italic</i>
The HTML <em> element defines emphasized text, with added semantic importance.
<em>This text is emphasized</em>
<b>
and <i>
are explicit - they specify bold and italic respectively.
<strong>
and <em>
are semantic - they specify that the enclosed text should be "strong" or "emphasised" in some way, usually bold and italic, but allow for the actual styling to be controlled via CSS. Hence these are preferred in modern web pages.
While <strong>
and <em>
are of course more semantically correct, there seem definite legitimate reasons to use the <b>
and <i>
tags for customer-written content.
In such content, words or phrases may be bolded or italicized and it is generally not up to us to analyze the semantic reasoning for such bolding or italicizing.
Further, such content may refer to bolded and italicized words and phrases to convey a specific meaning.
An example would be an english exam question which instructs a student to replace the bolded word.