The font property is a shorthand that sets an element’s typeface and related font values in one declaration. You can also set a system font with a single keyword such as caption.
Using font also resets related longhands (such as font-feature-settings and font kerning) to their initial values. Set those again after the shorthand if you still need them.
Syntax
CSS Syntax
syntax.css
font:[style] [variant] [weight] [stretch] size[/line-height] family | caption | menu | initial | inherit;
font-size and font-family are required in the shorthand form. font-family must be last.
Optional parts first.italic and bold come before the size.
Then size and family.1.25rem Georgia, serif finishes the required pair.
Order matters. Family must stay last; size comes after style/weight.
Same as longhands. This matches setting font-style, font-weight, font-size, and font-family separately.
Edge Cases & Pitfalls
Most invalid font rules miss size, family, or the slash.
required
Size and family are required
font: bold alone is invalid. Include both a size and a family (unless you use a system keyword).
order
Family must be last
Put the typeface stack at the end. Style, variant, weight, and stretch go before the size.
slash
Line-height needs a slash
Write 16px/1.5, not a bare second number after the size without /.
reset
Shorthand resets other font settings
A font declaration clears related longhands to initial. Re-apply features like kerning or OpenType settings afterward if needed.
system
System keywords stand alone
font: caption is valid. Mixing extras like font: caption 12px invalidates the declaration. Prefixed system names (-webkit-*, -moz-*) are non-standard.
Compatibility
Browser Support
font is a browser typography shorthand. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
font
Supported in Chrome, Firefox, Safari, Edge, Opera, and IE. System font keywords and stretch values have long-standing support.
99%All major browsers
Google Chrome1+
Full
Mozilla Firefox1+
Full
Apple Safari1+
Full
Microsoft Edge12+
Full
OperaSupported
Full
Samsung InternetSupported
Full
Internet Explorer4+
Full
fontWidely supported
Bottom line: Safe everywhere for size + family shorthand. Prefer longhands when you only need to change one font setting without resetting others.
Remember
Key Takeaways
Role: one shorthand for style, weight, size, line-height, and family — or a system font keyword.
Required:font-size and font-family (family last).
Line-height: write size/line-height, then the family.
Reset: the shorthand clears related font longhands to initial values.
One line:font packs typography into one rule — size and family required, everything else optional.
Frequently Asked Questions
It is a shorthand that sets font-style, font-variant, font-weight, font-size, line-height, and font-family together. It can also set a system font with a single keyword such as caption.
You must include font-size and font-family. Other parts are optional. If you set line-height, write it after size with a slash, like 16px/1.5.
It sets font-size to 16px and line-height to 1.5. The slash separates size and line-height inside the font shorthand.
font-family only chooses the typeface. The font shorthand can set style, weight, size, line-height, and family in one line.
Yes. Declaring font resets related longhands such as font-feature-settings and font-kerning to their initial values, even if you do not set them in the shorthand.
It is Baseline and widely available in all modern browsers and older ones too. It is a browser typography property, not a Node.js feature.