CSS font Property
The font property in CSS is a shorthand for setting multiple font-related properties in a single declaration.
1. Syntax
✅ Not all values are required, but at least font-size and font-family must be included.
2. Basic Usage
✅ Setting Font with Shorthand
✅ This applies:
italic→ Font stylesmall-caps→ Font variantbold→ Font weight16px→ Font size1.5→ Line heightArial, sans-serif→ Font family
3. Individual Properties in font Shorthand
| Property | Description |
|---|---|
font-style | Specifies italic, normal, or oblique. |
font-variant | Enables small-caps text. |
font-weight | Defines font thickness (normal, bold, 100–900). |
font-size | Specifies text size (px, em, %, rem). |
line-height | Controls space between lines. |
font-family | Defines the font to be used. |
4. Examples
✅ Simple Example (Font Size + Family)
✅ Applies Georgia font with 20px size.
✅ Full Font Shorthand Example
✅ Bold, 18px font size, 1.6 line height, Roboto font.
✅ Setting Italic Small-Caps Font
✅ Uses italic small-caps Verdana font.
5. When to Use font Shorthand?
✔ Saves space in CSS
✔ Improves readability
✔ Ensures consistent typography
6. Things to Remember
❌ Order matters! The font-family must be at the end.
❌ If font-variant, font-style, or font-weight are omitted, they default to normal.

