HTML Basics: Bold text – What is the difference between the HTML STRONG and the B tag?

What is the difference between STRONG and B?

STRONG and B are inline elements that do not generate an automatic line break.

The output of the two HTML tags, strong and b (bold), is usually displayed in the same way by the web browser. By default, both HTML elements display the text in bold. However, there is an important difference between them.

HTML Tag <strong> vs. <b>

In contrast to the B tag, the HTML STRONG tag has a semantic meaning, i.e. a content-related meaning. Text marked up with <strong> is important and is strongly emphasized. Important text starts with <strong> and has to be closed with </strong>.

Emphasized text is usually printed in bold. However, it is not sure that text marked with strong will be printed in bold in every browser.

The HTML B tag always displays text in bold. Boldfaced text starts with <b> and has to be closed with </b>. It is used if you want to highlight text visually using bold type but do not want to emphasize it semantically.

Advertisement
Example

Important text is created with the <strong> tag.

<strong>This text is especially important.</strong>
Output of the HTML code
This text is especially important.

Bold text without any special meaning is created with the <b> tag.

<b>This text is printed in bold type.</b>
Output of the HTML code
This text is printed in bold type.
Notes

Avoid double markups such as

<strong><em>This emphalized text is important.</em></strong>
Output of the HTML code
This emphalized text is important.
or
<em><strong>This important text is emphasized.</strong></em>
Output of the HTML code
This important text is emphasized.

The STRONG tag has a higher relevance than the EM tag. So it's better to use <i> instead of <em> if particularly important text should be displayed in bold and italics. This is the best variant to use:

<strong><i>This text in italics is important.</i></strong>
Output of the HTML code
This text in italics is important.
Avoid markups like
<strong><b>This text in bold type is important.</b></strong>
or
<b><strong>This important text is displayed bold.</strong></b>

Such constructions may be considered to be spam.

Advertisement