CSS Text Styling
Typography Fundamentals
Text styling is crucial for readability and visual hierarchy. CSS provides powerful properties to control how text appears on your website.
Font Family
The font-family property specifies which font to use. Always
provide fallback fonts in case the primary font isn't available.
Font Size
Control text size with font-size. Use px,
em, rem, or %.
Font Weight
The font-weight property controls how bold or light
text appears. Values range from 100 (thin) to 900 (black), or use
keywords like normal and bold.
Font Style & Line Height
font-style makes text italic, and
line-height controls spacing between lines for
better readability.
line-height: 1.5 to 1.8 for
body text to improve readability.
Key Takeaways
font-family- Choose fonts with fallbacksfont-size- Control text size (px, em, rem)font-weight- Make text bold or light (100-900)font-style- Make text italicline-height- Space between lines (1.5-1.8 recommended)
Quick Quiz
Which property controls the boldness of text?
Enjoying these tutorials?