Bold text in HTML & CSS

You can make text bold using the HTML <strong> and <b> tags. But these two are not only the options. You can also make any text bold in HTML using CSS.

In this post, I will show you all the possible ways to bolding text in HTML.

HTML bold text – all possible ways

Using <strong> tag

<p>Amet consectetur adipisicing elit possimus rerum distinctio incidunt necessitatibus <strong>numquam dolor</strong> sitamet consectetur unde reiciendis ducimus.</p>

See its output below.

Bold text in a paragraph using the HTML strong tag
Bold text in a paragraph using the <strong> tag

Using <b> tag

<p>Amet consectetur adipisicing elit possimus rerum distinctio incidunt necessitatibus <b>numquam dolor</b> sitamet consectetur unde reiciendis ducimus.</p>

See its output below.

Bold text in a paragraph using the HTML b tag
Bold text in a paragraph using the <b> tag

As you see this output is similar to the last one.

Bold text using CSS font-weight property

As mentioned earlier, you’re just not limited to using the HTML <strong> & <b> tags. You can also use CSS to make the font or text bold. Aside from the numeric values, you can use any of the following:

p {
  font-weight: bold;
  /* OR */
  font-weight: bolder;
}

The bold value is similar to 700 and bolder is heavier than its parent.

The above CSS will make an entire paragraph bold. But if you need certain words to make bold, you can wrap them within <span> tag or add a CSS class or ID. See the following HTML & CSS for more clarification.

<p>Amet consectetur adipisicing elit possimus rerum distinctio incidunt necessitatibus <span>numquam dolor</span> sitamet consectetur unde reiciendis ducimus.</p>

<p>Amet consectetur adipisicing elit possimus rerum distinctio incidunt necessitatibus <span class="bold-text">numquam dolor</span> sitamet consectetur unde reiciendis ducimus.</p>

<p>Amet consectetur adipisicing elit possimus rerum distinctio incidunt necessitatibus <span id="bold-font">numquam dolor</span> sitamet consectetur unde reiciendis ducimus.</p>
span {
  font-weight: bold;
}
/* OR */ 
.bold-text {
  font-weight: bold;
}
/* OR */ 
#bold-font {
  font-weight: bold;
}

For the above HTML & CSS, the output looks like the screenshot you see below.

Bold text in three different paragraphs

Use any of the approaches or a combination of them or whatever best suits your project.

Types of font weight in CSS

There are lots of font-weight values you can choose from such as 100, 300, 900, lighter, bold, bolder, etc.

But all these font-weight values fall into two main categories: relative & absolute.

Relative font weight: bolder, lighter, etc are examples of it.

Absolute font-weight: 400, 700, 900, and all the numeric values are examples in this category.

If you don’t know, “Google Fonts” is a great resource & easy to use. And it’s also free. You can go to their website, and choose one or more fonts along with your preferred weights.

For the best font pairs, I have a few recommendations. You can check this post after to learn more.

Learn & practice CSS with real-world examples
Learn basic CSS from the ground up.
Build real projects in HTML CSS.
Make your hands dirty

Build HTML CSS projects

About us templatePreview
Team pagePreview
Testimonial pagePreview
Testimonial sliderPreview
Contact pagePreview
Multipage websitePreview
Portfolio websitePreview
Animated portfolioPreview
Computer science portfolioPreview
Navigation bar (without JS)N/A
Create a hamburger menuPreview
Create a navigation menu in two waysN/A
Footer templatesPreview
Hero bannerPreview
Background sliderPreview
Card templates (HTML, CSS)Preview
Animated cardsPreview
Three-column layout templatePreview
Two column layoutPreview
Breadcrumb navigationN/A
Progress bar templatePreview
Thank you pagePreview
Resume templatePreview
Coming soon templatePreview
Landing page templatePreview
Roofing website templatePreview

Conclusion

Now you knew how to make text bold in HTML and using CSS. This is an opportunity to highlight certain parts of your text.