Bird
Raised Fist0
CSSmarkup~15 mins

Font weight in CSS - Deep Dive

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Overview - Font weight
What is it?
Font weight is a way to make text look thicker or thinner by changing how bold it appears. It controls the darkness or lightness of letters on a webpage. You can choose from normal, bold, or numbers that represent different thickness levels. This helps make important words stand out or create a style for your text.
Why it matters
Without font weight, all text would look the same, making it hard to show emphasis or organize information visually. It helps readers quickly spot headings, important points, or links. Good use of font weight improves readability and makes websites look more attractive and easier to use.
Where it fits
Before learning font weight, you should understand basic CSS and how to style text with properties like font-family and color. After mastering font weight, you can explore advanced typography techniques like font size, line height, and font style to create beautiful, readable text layouts.
Mental Model
Core Idea
Font weight controls how thick or thin the letters of text appear, making some words stand out more than others.
Think of it like...
Imagine writing with a pencil: pressing lightly makes thin lines, pressing hard makes thick, dark lines. Font weight is like how hard you press when drawing letters.
Text Appearance
┌───────────────┐
│ Thin (100)    │
│ Normal (400)  │
│ Bold (700)    │
│ Extra Bold (900)│
└───────────────┘

Numbers show thickness from light to heavy.
Build-Up - 6 Steps
1
FoundationWhat is font weight in CSS
🤔
Concept: Font weight changes how thick or thin text looks on a webpage.
In CSS, font weight is a property that controls the thickness of text. You can write it like this: p { font-weight: bold; } This makes the paragraph text bold. You can also use 'normal' for regular thickness.
Result
Text inside the paragraph appears thicker and darker than normal text.
Understanding font weight as a simple way to make text stand out helps you control visual emphasis easily.
2
FoundationUsing numeric font weight values
🤔
Concept: Font weight can be set using numbers from 100 to 900 to specify exact thickness.
Instead of words like 'bold', CSS lets you use numbers: h1 { font-weight: 700; } Numbers go from 100 (thin) to 900 (extra bold). Not all fonts support every number, but 400 is normal and 700 is bold.
Result
The heading text becomes bold with a thickness level of 700.
Knowing numeric values gives you precise control over text thickness beyond just 'normal' or 'bold'.
3
IntermediateHow font weight affects readability
🤔Before reading on: Do you think making all text bold improves readability or can it cause problems? Commit to your answer.
Concept: Using font weight wisely helps guide the reader's eye and improves how easy text is to read.
Bold text draws attention, so use it for headings or important words. Too much bold text can make a page look messy and hard to read. Light font weights can be elegant but may be hard to see on small screens or low contrast backgrounds.
Result
Text with varied font weights looks organized and easier to scan, while uniform bold text feels cluttered.
Understanding the balance of font weight helps create clear, user-friendly designs that guide readers naturally.
4
IntermediateFont weight and font families compatibility
🤔Before reading on: Do you think all fonts support every font weight number from 100 to 900? Commit to your answer.
Concept: Not all fonts have all font weight styles; some only have normal and bold.
Fonts come with specific weights built-in. For example, Arial usually supports normal (400) and bold (700). Some fonts like Roboto have many weights (100, 300, 400, 500, 700, 900). If you use a weight not supported, the browser picks the closest available.
Result
Text may not appear as expected if the font lacks the requested weight, falling back to the nearest weight.
Knowing font weight support prevents surprises and helps you pick fonts that fit your design needs.
5
AdvancedUsing variable fonts for smooth weight control
🤔Before reading on: Do you think font weight can be smoothly changed in small steps or only in fixed jumps? Commit to your answer.
Concept: Variable fonts allow font weight to change smoothly across a range, not just fixed steps.
Variable fonts are a new kind of font that can adjust weight continuously, for example from 100 to 900 in tiny steps. You use the same CSS font-weight property, but the font file supports smooth transitions. Example: p { font-weight: 350; } This makes text thickness between normal and semi-bold.
Result
Text appears with a custom thickness, not limited to standard weights, creating subtle style differences.
Understanding variable fonts unlocks advanced typography control and better design flexibility.
6
ExpertBrowser rendering and font weight fallback
🤔Before reading on: If a font weight is not available, do browsers always pick the closest weight or sometimes simulate boldness? Commit to your answer.
Concept: Browsers try to find the closest font weight or simulate bold if needed, affecting text appearance.
When a font weight is missing, browsers first look for the nearest available weight. If none is close, they may fake bold by drawing text thicker. This can cause blurry or uneven text. Developers can control this by choosing fonts carefully or using font-display and font-synthesis CSS properties.
Result
Text may look different than expected, sometimes less sharp or inconsistent across browsers.
Knowing how browsers handle missing weights helps avoid visual bugs and ensures consistent text appearance.
Under the Hood
Font weight works by selecting different font files or font faces that represent various thicknesses of the same typeface. When you set font-weight in CSS, the browser asks the operating system or font engine to load the matching font variant. If the exact weight is unavailable, the browser picks the closest one or simulates bold by drawing strokes thicker. Variable fonts store all weights in one file and adjust thickness dynamically using font tables.
Why designed this way?
Originally, fonts came with only a few fixed weights like normal and bold because of file size and design limits. As digital typography evolved, designers wanted more control, leading to numeric weights and variable fonts. Browsers had to support fallback and simulation to handle missing weights gracefully, balancing performance and appearance.
CSS font-weight property
      │
      ▼
┌─────────────────────┐
│ Browser receives CSS │
│ font-weight value    │
└─────────┬───────────┘
          │
          ▼
┌─────────────────────┐
│ Check font family    │
│ available weights    │
└─────────┬───────────┘
          │
  ┌───────┴────────┐
  │                │
  ▼                ▼
Exact weight    Closest weight
available?      available?
  │                │
  ▼                ▼
Use font file   Use nearest font
for weight      file or simulate
                 bold
  │                │
  ▼                ▼
Render text     Render text
with chosen     with fallback
weight          weight
Myth Busters - 4 Common Misconceptions
Quick: Does setting font-weight to 'bold' always mean the text uses a separate bold font file? Commit yes or no.
Common Belief:Setting font-weight to 'bold' always loads a separate bold font file.
Tap to reveal reality
Reality:Sometimes browsers simulate bold by thickening normal font strokes if a bold font file is missing.
Why it matters:This can cause blurry or uneven text, reducing readability and design quality.
Quick: Do you think numeric font weights like 350 or 600 always work on all fonts? Commit yes or no.
Common Belief:Any numeric font weight value works on all fonts and browsers.
Tap to reveal reality
Reality:Many fonts only support certain weights (like 400 and 700), so other numbers fall back to the nearest supported weight.
Why it matters:Using unsupported weights can lead to inconsistent text appearance across devices.
Quick: Is a higher font-weight number always darker and thicker than a lower number? Commit yes or no.
Common Belief:Higher font-weight numbers always mean thicker, darker text.
Tap to reveal reality
Reality:While usually true, some fonts may have unusual weight mappings or styles that don't follow this rule exactly.
Why it matters:Assuming numeric order always matches thickness can cause unexpected design results.
Quick: Does using font-weight alone guarantee good readability? Commit yes or no.
Common Belief:Using bold font weight alone makes text easy to read.
Tap to reveal reality
Reality:Too much bold text or improper contrast can reduce readability despite font weight.
Why it matters:Relying only on font weight without considering other factors can hurt user experience.
Expert Zone
1
Some variable fonts allow animating font weight smoothly for dynamic effects, but this requires careful performance testing.
2
Font weight synthesis can be controlled with CSS properties like font-synthesis to prevent unwanted bold simulation.
3
Different browsers and operating systems may render the same font weight slightly differently due to font rendering engines and anti-aliasing.
When NOT to use
Avoid relying solely on font weight for emphasis in designs where color contrast or font size changes are more accessible. For complex typography, consider using font style or custom font files instead of numeric weights when precise control is needed.
Production Patterns
In production, designers use font weight to create clear visual hierarchies, combining it with font size and color. Variable fonts are increasingly used for responsive typography, allowing smooth weight changes across devices. Developers test font weight rendering on multiple browsers to ensure consistent appearance.
Connections
Visual hierarchy in design
Font weight is a key tool to build visual hierarchy by making some text stand out more than others.
Understanding font weight helps grasp how designers guide users' attention through size and boldness differences.
Accessibility and contrast
Font weight affects text visibility and readability, which are crucial for accessible design.
Knowing font weight's role in contrast helps create websites usable by people with vision impairments.
Pressure sensitivity in drawing (Art)
Both font weight and pressure sensitivity control line thickness to express emphasis or style.
Recognizing this connection shows how digital text styling relates to physical drawing techniques.
Common Pitfalls
#1Using font-weight values not supported by the font.
Wrong approach:p { font-weight: 350; } /* font only supports 400 and 700 */
Correct approach:p { font-weight: 400; } /* use supported weight for consistent rendering */
Root cause:Assuming all numeric weights work on every font without checking font support.
#2Making all text bold to emphasize everything.
Wrong approach:body { font-weight: bold; } /* entire page is bold */
Correct approach:h1, h2 { font-weight: bold; } p { font-weight: normal; } /* only headings bold */
Root cause:Misunderstanding that too much bold text reduces readability and visual clarity.
#3Relying on browser to simulate bold when font file is missing.
Wrong approach:Using a font without a bold variant and expecting crisp bold text.
Correct approach:Choose fonts with proper bold weights or use variable fonts for smooth control.
Root cause:Not verifying font files include needed weights before styling.
Key Takeaways
Font weight controls how thick or thin text appears, helping create emphasis and style.
You can use named values like 'normal' and 'bold' or numeric values from 100 to 900 for precise control.
Not all fonts support every weight number, so browsers pick the closest available or simulate bold.
Variable fonts allow smooth changes in font weight, offering advanced design flexibility.
Using font weight wisely improves readability and visual hierarchy, but overusing bold can harm clarity.

Practice

(1/5)
1. What does the CSS property font-weight control in text?
easy
A. How thick or thin the text appears
B. The color of the text
C. The size of the text
D. The font family used

Solution

  1. Step 1: Understand the role of font-weight

    The font-weight property changes the thickness of the text, making it look bolder or lighter.
  2. Step 2: Compare with other text properties

    Color changes text color, size changes text size, and font family changes the font style, not thickness.
  3. Final Answer:

    How thick or thin the text appears -> Option A
  4. Quick Check:

    font-weight controls thickness [OK]
Hint: Remember: weight means thickness of letters [OK]
Common Mistakes:
  • Confusing font-weight with font-size
  • Thinking font-weight changes color
  • Mixing font-weight with font-family
2. Which of the following is the correct CSS syntax to make text bold using font-weight?
easy
A. font-weight: bold;
B. font-weight: 1000;
C. font-weight: heavy;
D. font-weight: strong;

Solution

  1. Step 1: Recall valid font-weight values

    Valid values include keywords like normal, bold, or numbers 100 to 900 in steps of 100.
  2. Step 2: Check each option

    font-weight: bold; uses bold which is correct. font-weight: 1000; uses 1000 which is invalid. Options A and D use invalid keywords.
  3. Final Answer:

    font-weight: bold; -> Option A
  4. Quick Check:

    Use 'bold' keyword for bold text [OK]
Hint: Use 'bold' keyword or 700 for bold text [OK]
Common Mistakes:
  • Using numbers outside 100-900 range
  • Using invalid keywords like 'heavy' or 'strong'
  • Missing semicolon at end
3. What will be the visual difference between these two CSS rules?
p.normal { font-weight: 400; }
p.bold { font-weight: 700; }
medium
A. Text with class 'bold' is italicized
B. Both texts look exactly the same
C. Text with class 'normal' is bolder than 'bold'
D. Text with class 'normal' is thinner than text with class 'bold'

Solution

  1. Step 1: Understand numeric font-weight values

    400 is the normal weight, and 700 is the bold weight, so 700 is thicker text.
  2. Step 2: Compare the two classes visually

    Text with class 'normal' will appear thinner than text with class 'bold'. Italic style is unrelated to font-weight.
  3. Final Answer:

    Text with class 'normal' is thinner than text with class 'bold' -> Option D
  4. Quick Check:

    400 < 700 means thinner < bolder [OK]
Hint: Higher number means thicker text [OK]
Common Mistakes:
  • Thinking 400 is bolder than 700
  • Confusing font-weight with font-style
  • Assuming no difference between 400 and 700
4. Identify the error in this CSS snippet:
h1 { font-weight: 950; }
medium
A. Missing units after 950
B. 950 is not a valid font-weight value
C. font-weight cannot be used on h1
D. Should use font-style instead of font-weight

Solution

  1. Step 1: Check valid font-weight numeric values

    Valid numeric values are multiples of 100 from 100 to 900 only.
  2. Step 2: Validate the given value

    950 is outside the valid range, so it is invalid and will be ignored by browsers.
  3. Final Answer:

    950 is not a valid font-weight value -> Option B
  4. Quick Check:

    font-weight numbers must be 100-900 [OK]
Hint: Use multiples of 100 between 100 and 900 [OK]
Common Mistakes:
  • Using numbers outside 100-900
  • Adding units like px or em to font-weight
  • Confusing font-weight with font-style
5. You want to highlight a warning message by making its text thicker but not fully bold. Which font-weight value is best to use?
hard
A. font-weight: 300;
B. font-weight: 900;
C. font-weight: 600;
D. font-weight: normal;

Solution

  1. Step 1: Understand font-weight scale

    Lower numbers like 300 are light, 400 is normal, 700 is bold, and 900 is very bold.
  2. Step 2: Choose a weight thicker than normal but less than bold

    600 is between normal (400) and bold (700), so it makes text thicker but not fully bold.
  3. Final Answer:

    font-weight: 600; -> Option C
  4. Quick Check:

    600 is semi-bold, perfect for emphasis [OK]
Hint: Use 600 for semi-bold emphasis [OK]
Common Mistakes:
  • Using 300 which is lighter than normal
  • Using 900 which is too bold
  • Using 'normal' which is not thicker