totn HTML

HTML: <b> tag

This HTML tutorial explains how to use the HTML element called the <b> tag with syntax and examples.

Description

The HTML <b> tag merely gives text a bold appearance but does not provide any semantic meaning to the text. This tag is also commonly referred to as the <b> element.

TIP: The HTML <b> tag should not be confused with the <strong> tag which gives text a strong emphasis.

Syntax

In HTML, the syntax for the <b> tag is:

<body>
<p><b>Bolded text goes here</b> and not here</p>
</body>

Sample Output


Attributes

Only the Global Attributes apply to the <b> tag. There are no attributes that are specific to the <b> tag.

Note

  • The HTML <b> element is found within the <body> tag.
  • The <b> tag is used to bold text but does not put emphasis on the text like the <strong tag> does.
  • In most cases, it is recommended that you use the <strong> tag rather than the <b> tag.

Browser Compatibility

The <b> tag has basic support with the following browsers:

  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • Edge Mobile
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <b> tag below, exploring examples of how to use the <b> tag in HTML5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.