CSS
CSS: How to Make Text Bold
Making text bold is one of the simplest and most commonly used formatting techniques in web design. Whether you’re emphasizing headings, labels, buttons, or important content, bold text helps catch the user’s eye.
In this blog post, you’ll learn:
- β How to make text bold using CSS
- π€ Different ways to apply boldness (with tags, classes, and inline styles)
- π¨ How to control font weight beyond just “bold”
- π§ͺ Practical examples and best practices
β
1. Use font-weight
Property in CSS
The most direct way to make text bold in CSS is by using the font-weight
property.
β Example:
<p class="bold-text">This text is bold.</p>
.bold-text {
font-weight: bold;
}
This applies bold styling to any element with the bold-text
class.
π€ 2. Use Numeric Font Weights (for More Control)
CSS allows numeric values for more precise control over font boldness:
Value | Description |
---|---|
100 | Thin (lightest) |
400 | Normal (default) |
700 | Bold |
900 | Extra Bold |
β Example:
.extra-bold {
font-weight: 900;
}
π Note: The actual result depends on the font you’re using. Not all fonts support all weights.
β 3. Inline CSS for Quick Styling
If you’re not using an external stylesheet, you can bold text with inline CSS:
<span style="font-weight: bold;">Bold text inline</span>
β Useful for one-off styles, but external CSS is preferred for maintainability.
β 4. Semantic HTML Tags That Render Bold by Default
You can also use HTML tags that make text bold:
<b>
β purely stylistic bold<strong>
β semantic emphasis + bold appearance
Example:
<b>This is bold</b>
<strong>This is strongly emphasized</strong>
π§ Best practice: Use <strong>
for important content that needs emphasis (like warnings), and style the rest with CSS.
π¨ Styling Buttons, Labels, or Headings
Bold text is often used in:
button {
font-weight: bold;
}
h1, h2, h3 {
font-weight: 700;
}
β Makes UI elements stand out and improves readability.
π§ Summary
Method | Use Case |
---|---|
font-weight: bold | General purpose bold styling |
font-weight: 700 | Numeric bold (custom control) |
Inline styles | Quick, one-off usage |
<b> , <strong> | HTML-based bold (semantic or visual) |
π Final Thoughts
Using bold text with CSS is simple but powerful. It helps guide the userβs attention and improves content hierarchy. Whether you use classes, inline styles, or semantic tags, always use bold thoughtfully for clarityβnot clutter.