HTML Tutorial: Complete HTML Tutorial
About Lesson

HTML <b> Tag


The HTML <b> tag is used to make text bold within a webpage. Unlike other tags that emphasize importance, the <b> tag is purely for visual styling and does not convey any semantic meaning. It’s a simple way to draw attention to specific parts of the text without indicating that the text is of particular significance.

Example 1: Simple Bold Text

A basic example of using the <b> tag:

<p>This is <b>bold</b> text.</p>

Example 2: Combining with Other Tags

You can combine the <b> tag with other HTML tags:

<p>This is <b><i>bold and italic</i></b> text.</p>

Let’s try the b tag below with custom css

powered by Advanced iFrame. Get the Pro version on CodeCanyon.

Browser Support

Sponsored by Google

The <b> tag is widely supported across all major browsers:

Browser Support
Chrome Yes
Firefox Yes
Safari Yes
Edge Yes
Internet Explorer Yes

Global and Event Attributes

The <b> tag also supports various global and event attributes in HTML, allowing for further customization and interactivity.

Example: Styling Text with Bold

Here’s an example of how you can use the <b> tag to make some text bold:

<!DOCTYPE html>
<html>
<head>
  <style>
    b.custom {
      color: red;
      font-size: 20px;
    }
  </style>
</head>
<body>

<p>This is <b class="custom">custom bold</b> text.</p>

</body>
</html>

Conclusion

The <b> tag is a versatile and widely-supported element for applying bold styling to text. While its primary function is to render text in bold, it can be combined with other HTML elements and customized with CSS to achieve various visual effects.


Remember, the <b> tag is purely for visual styling and does not convey any semantic meaning. If you want to emphasize text for semantic reasons, consider using the <strong> tag instead.