0
0
CSSmarkup~3 mins

Why Font weight in CSS? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

Discover how a single CSS property can transform your text from plain to powerful instantly!

The Scenario

Imagine you are designing a webpage and want some text to look bold to grab attention, while other text stays normal. You try to make text bold by manually changing the font style in an image editor or by using different font files for each weight.

The Problem

This manual way is slow and tricky. You have to create or find separate font files for each thickness, and if you want to change the weight later, you must redo everything. It's hard to keep text consistent and update styles quickly.

The Solution

CSS font weight lets you easily control how thick or thin your text looks by just changing one property. You can pick from normal, bold, or numeric weights like 400 or 700, and the browser handles the rest automatically.

Before vs After
Before
font-family: 'MyBoldFont'; /* separate font file for bold */
font-family: 'MyRegularFont'; /* separate font file for normal */
After
font-weight: 700; /* bold text */
font-weight: 400; /* normal text */
What It Enables

You can quickly and consistently change text thickness across your whole site with simple CSS, making your design flexible and easy to update.

Real Life Example

On a blog, you want headings to stand out with bold text and paragraphs to stay normal. Using font weight, you just add font-weight: bold; to headings and font-weight: normal; to paragraphs without extra font files.

Key Takeaways

Font weight controls text thickness using simple CSS.

It avoids the need for multiple font files for different weights.

It makes styling text faster, easier, and more consistent.