HTML5 <b> Tag

The HTML <b> tag is used to represent a span of text that is stylistically different from normal text. This tag does not conveying any special importance or relevance of the text inside it. It is typically rendered in boldface.

The only content permitted inside this element is Phrasing content. Both the starting and ending tag are mandatory for this element. Any element that accepts phrasing content can be the parent of the <b> tag.

There are a few things you should keep in mind while using this tag/element:

  • You should use the <b> for cases like keywords in a summary, product names in a review, or other spans of text whose typical presentation would be boldfaced.
  • You should not mark titles and headings on a webpage using the <b> element. You should use the appropriate tags like <h1> to <h6> for this purpose.
  • It is a good practice to use the class attribute on the <b> in order to convey additional semantic information (for example <b class="lead"> for the first sentence in a paragraph).
  • If there is no semantic purpose of using the <b> element, using the CSS font-weight property with bold value would be a better choice for making text bold.

The following style is applied to this element by default:

b {
  font-weight: bold;
}

Here is a basic example of using this tag:

<p>The shirt was available in only <b>medium</b> and <b>large</b> sizes.</p>

Attributes

This element only accepts global attributes.

Examples

See the Pen HTML b Tag by Tutorialio (@tutorialio) on CodePen.

Further Reading

  1. Read more about the HTML <b> element on MDN.
  2. You can also read the HTML <b> tag reference on W3C.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top