🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #53

Font Shorthand


The CSS Font Shorthand Property

To shorten the code, it is possible to specify all the individual font properties in one declaration.

The CSS font property is a shorthand property for:

  • font-style
  • font-variant
  • font-weight
  • font-stretch
  • font-size
  • line-height
  • font-family

Rules for the CSS Font Shorthand Property

  1. The font-size and font-family values are required. If one of the other values is missing, their default value are used.
  2. If defined, font-style, font-variant and font-weight must precede font-size.
  3. If defined, line-height must immediately follow font-size, preceded by "/", like this: 15px/30px.
  4. font-family must be the last value specified.

Example

    p.a {
  font: 20px Arial, sans-serif;
}

p.b {
  font:
    italic bold 16px Arial, sans-serif;
}

p.c {
  font: italic
    small-caps bold 15px/30px Georgia, serif;
}

All CSS Font Properties

Property Description
font Sets all the font properties in one declaration
font-family Specifies the font family for text
font-size Specifies the font size of text
font-style Specifies the font style for text
font-variant Specifies whether or not a text should be displayed in a small-caps font
font-weight Specifies the weight of a font

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Font Shorthand – FAQs

Quick answers about learning Font Shorthand in CSS.

This free note from CodingNow 2.0 explains Font Shorthand in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Font Shorthand, is 100% free with no signup required.
With focused practice, most students grasp Font Shorthand in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now