CSS Portal

CSS font Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The font shorthand property provides a single, compact way to set multiple font-related longhand properties at once. It is used to express the overall typographic appearance — such as family, size, weight, style and related metrics — from a single declaration, which makes rules shorter and helps keep typography consistent when you want several font aspects to change together.

Using the shorthand is effectively atomic: it assigns values to a collection of individual font properties and any subproperties not explicitly given in the shorthand are reset to their initial values. Because many of the individual font properties are inherited by default, applying the shorthand on an ancestor often cascades those settings to descendants. When you need to affect only one aspect of the font (for example adjusting only the font-weight or only the line-height), prefer the corresponding longhand; otherwise the shorthand can unintentionally overwrite other font-related settings such as font-style or font-variant.

From a practical and maintenance perspective, the shorthand is excellent for defining complete typographic rules for components or sections (for example, a site’s body text or a set of headings) because it reduces repetition and makes the intent explicit. Be mindful that newer or more specialized font features that are not included in the shorthand—such as variable-font axes or explicit variation settings—need to be set with their own properties (for example font-variation-settings). Also remember that the cascade still applies: later rules and more specific selectors override earlier shorthand declarations, and using the shorthand will override any earlier longhand values for the same font aspects. Finally, for predictable results, consider grouping font-related decisions (family, size, weight, and metrics) consciously so that the shorthand’s resetting behavior doesn’t remove intentional longhand customizations like a previously set font-stretch or an explicit font-size adjustment.

Definition

Initial value
See individual properties
Applies to
All elements
Inherited
Yes
Computed value
See individual properties
Animatable
See individual properties
JavaScript syntax
object.style.font

Interactive Demo

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass. A lone dandelion seed, adrift on the breeze, whispered secrets of faraway fields, of dandelion suns and galaxies spun from fluff. Somewhere, beyond the veil of dusk, a coyote laughed, echoing through the stillness like a forgotten memory.

Syntax

font: [ [ <font-style> || <font-variant> || <font-weight> || <font-stretch> ]? <font-size> [ / <line-height> ]? <font-family> ] | caption | icon | menu | message-box | small-caption | status-bar 

Values

  • <font-style>See the font-style CSS property for values.
  • <font-variant>See the font-variant CSS property for values.
  • <font-weight>See the font-weight CSS property for values.
  • <font-size>See the font-size CSS property for values.
  • <font-family>See the font-family CSS property for values.

Example

<div class='font-demo'>
<h1 class='title'>CSS font shorthand example</h1>
<p class='subtitle'>Using the font shorthand property and font-family fallbacks</p>
<p class='body-text'>This paragraph uses the font shorthand: italic small-caps bold 18px/1.4 'Merriweather', Georgia, serif.</p>
<p class='system-text'>This paragraph uses a system font stack: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif.</p>
</div>
.font-demo {
  padding: 1.5rem;
  background: #f8f9fb;
  color: #222;
  max-width: 60rem;
  margin: 2rem auto;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.font-demo .title {
  font: italic small-caps 700 28px/1.1 'Merriweather', Georgia, serif;
  margin: 0 0 0.5rem 0;
}

.font-demo .subtitle {
  font: 600 18px/1.2 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0 0 1rem 0;
  color: #444;
}

.font-demo .body-text {
  font: italic small-caps bold 18px/1.4 'Merriweather', Georgia, serif;
  margin: 0 0 0.75rem 0;
}

.font-demo .system-text {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
}

Browser Support

The following information will show you the current browser support for the CSS font property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!