Aabestfontgenerator.
THE TYPE NOTEBOOK

CSS Font Properties and the font Shorthand

Set CSS font shorthand values in order, distinguish size from line height and spot properties that reset when a shorthand omits them.

Use the font shorthand for an intentional set of values. Use separate properties when you want to change one setting while retaining the others.

Sources reviewed .

COMPARE REAL FONTS

Try the collection.

Read the selection notes ↓

Enter the same words in each specimen to compare. These are editorial starting points; explore each family for its background and license.

LIVE TYPEFACE SPECIMEN

See your words in Inter.

Real font preview
Loading Inter…
Get font from the official source ↗

This preview uses a real font. Copying ordinary text into another app will not carry this font with it. The PNG keeps the visual appearance.

Explore Inter: history, styles and license ↗

LIVE TYPEFACE SPECIMEN

See your words in Source Serif 4.

Real font preview
Loading Source Serif 4…
Get font from the official source ↗

This preview uses a real font. Copying ordinary text into another app will not carry this font with it. The PNG keeps the visual appearance.

Explore Source Serif 4: history, styles and license ↗

01

Put the size and family in their required positions

For a normal shorthand example, use font: italic 600 1rem/1.5 Inter, sans-serif. The style and weight come before the size, the line height follows a slash and the family list comes last. W3C’s CSS Fonts definition describes the syntax and initial-value resets. Treat the example as a starting point and use a family and weight actually available to the page.

02

Use a separate property for a single change

If a component already has a family, weight and line height and you want only a larger size, set font-size. A new font shorthand can reset properties that you leave out. Compare a heading and paragraph before and after the change and inspect the resulting styles. Look for a line-height change if the spacing suddenly becomes tighter.

03

Check the style at the actual element

A declaration can lose to a later rule or a more specific selector. Inspect the matched rules and computed family, size, line height and weight at the element you changed. If the font still looks different, check the loaded resource as well. For a separate plain-text treatment try the homepage lettering tool.

GOOD QUESTIONS

Your questions, answered.

Can I put the family name before the size in a font shorthand?

The family list follows the size and optional line height in the ordinary shorthand form.

What happens if the new shorthand omits the weight?

It can reset the weight to its initial value. Use a longhand property when you only intend to change one setting.

Sources & background

Sources supporting this page’s explanations. Practical examples are our editorial suggestions.