HTML Bold Element

HTML Bold <b> tag is used to make text bold in HTML document. Please note that using Bold tag to mark some text does not make the text important.

Example

A simple Bold element is shown in the following example.

index.html

<!DOCTYPE html>
<html>
    <body>
        <p>normal text <b>bold text</b></p>
    </body>
</html>

Note: HTML Bold element starts with the tag <b> and ends with an end tag </b>.

Default CSS for Bold

By default, following CSS properties are set for a Bold element.

font-weight: bold;

Inline Style for HTML Bold

We can change the style of Bold element through inline styling using style attribute.

In the following example, we have set the color as red for the Bold element.

index.html

<!DOCTYPE html>
<html>
    <body>
        <p>normal text <b style="color:red;">bold text</b></p>
    </body>
</html>

Apply CSS for Bold Element

We can apply CSS for all Bold elements using the b tag.

index.html

<!DOCTYPE html>
<html>
    <head>
        <style>
            b {
              color:red;
            }
          </style>
    </head>
    <body>
        <p>normal text <b>bold text</b></p>
    </body>
</html>

Conclusion

In this HTML Tutorial, we learned about HTML Bold tag and went through different examples that cover defining a Bold element, and styling it.