How to Use HTML bold tag and Setting Bold Text with CSS

How to Use HTML bold tag and Setting Bold Text with CSS

HTML bold tag

HTML comes up with the <b> tag to make text bold i.e. text is darkened to help emphasize a remark or comment. You have to use closing </b> tag otherwise whole text following <b> tag will appear as bold.

Note that, the text in headings like <h1>, <h2> etc. is bold by default.

Syntax of bold tag

The syntax of bold tag in HTML is:

<b>some text to be bold</b>

Example of using HTML bold tag

The following example uses <b> tag to make text bold in <p> and <div> tag’s text.

HTML bold text

Experience this online

Bold text by using CSS

You can also use CSS to make text bold. It allows using different thickness level for text. The property that is used to make text bold is font-weight.

To set text bold with font-weight the syntax is:

font-weight: bold;

Example of using font-weight property

The following example sets the text bold by using font-weight property. It also uses numeric value to make bold text to show you how boldness can be from thinner to thicker by changing the numeric value.

HTML bold CSS

Experience this online

 

Also see HTML font | CSS font