Table of Contents
The beauty about CSS is that you can control so much of the design simply by applying design properties to the HTML elements.
One of most important parts of design is fonts and text in general.
In this post, we'll learn how to make text bold using CSS.
How to make text bold using CSS
When you want to make text bold, you can use the font-weight
property on the text element.
The font-weight
property can be set to a number between 100
and 900
. The higher the number, the bolder the text.
The default/normal value is 400
. You can also use normal
and bold
as values which are equivalent to 400
and 700
respectively.
Let's look at an example:
HTML<p class="normal">Normal text</p>
<p class="bold">Bold text</p>
CSS.normal {
font-weight: 400;
}
.bold {
font-weight: 700;
}
- HTML
- CSS
That's all you need to do to see change the font weight and render bold text.
Conclusion
In this post, we learned how to make text bold using CSS.
Simply apply the font-weight
property to the text element and set it to a value between 100
and 900
or use normal
or bold
.
Thanks for reading!
- How to Install Node on Windows, macOS and Linux
- Getting Started with Solid
- Getting Started with Electron
- Git Tutorial: Learn how to use Version Control
- How to Set Up Cron Jobs in Linux
- How to deploy a MySQL Server using Docker
- How to deploy an Express app using Docker
- How to Scrape the Web using Node.js and Puppeteer
- Getting Started with Handlebars.js
- Build a Real-Time Chat App with Node, Express, and Socket.io
- Getting Started with Moment.js
- Using Axios to Pull Data from a REST API