HTML Bold
This page provides "HTML bold" code. By "HTML bold", I mean code that makes changes the text weight to bold.
There is more than one way to create bold text in HTML. Below are the various methods of creating bold text.
The <strong>
Tag
The <strong>
tag is used to give text a stronger importance. Only use this tag when the enclosed text is actually more important than its surrounding text.
The <b>
Tag
The <b>
tag is to markup text as bold without conveying any extra importance. For example, this could be useful in article abstracts, where the beginning of an article is set in bold text.
Using Cascading Style Sheets (CSS)
You can use CSS instead of, or in conjunction with, the above HTML tags. To make text bold with CSS, use the font-weight
property. Here's an example:
Source Code | Result |
---|---|
font-weight: normal font-weight: bold font-weight: bolder font-weight: lighter font-weight: 100 font-weight: 200 font-weight: 300 font-weight: 400 font-weight: 500 font-weight: 600 font-weight: 700 font-weight: 800 font-weight: 900 |
Note that, although this property allows you to specify various levels of boldness, most browsers can only render two levels (bold and normal). Therefore, if you only see two different levels of bold above, this would be why. The most common values are bold
and normal
(which overrides any bold setting).