CSS Font Properties
CSS provides various font-related properties to control the appearance of text, including font family, size, weight, style, and more.
1. Setting the Font Family (font-family)
Defines the font type for text. Always include a fallback font.
✅ Uses Arial; if unavailable, it falls back to any sans-serif font.
š¹ Common Font Families:
- Serif:
"Times New Roman",Georgia - Sans-serif:
"Arial","Helvetica","Verdana" - Monospace:
"Courier New","Monaco" - Cursive:
"Brush Script MT"
2. Setting Font Size (font-size)
✅ Sets the font size to 24 pixels.
š¹ Units You Can Use:
px(pixels) – Fixed sizeem– Relative to parentrem– Relative to root (html)%– Relative to default size
Example:
3. Font Weight (font-weight)
Controls text boldness.
š¹ Other values:
normal(default)boldlighter/bolder100to900(where100is thin and900is extra bold)
Example:
4. Font Style (font-style)
Controls whether a text is italicized.
š¹ Values: normal, italic, oblique.
5. Font Variant (font-variant)
Controls small caps text.
✅ Displays lowercase letters as smaller uppercase letters.
6. Font Stretch (font-stretch)
Adjusts the width of characters.
š¹ Other values: condensed, semi-condensed, ultra-expanded, etc.
7. Shorthand for Fonts (font)
Instead of writing multiple properties, use a shorthand:
✅ This is equivalent to:
Example Usage in a Full CSS Rule

