Home·CSS properties

font

Text

Sets several font values at once; anything omitted resets to its default.

How to write itfont: 1rem/1.5 sans-serif;
Common values1rem/1.5 sans-serif
InheritedYes — children receive it
Sets all offont-style, font-weight, font-size, line-height, font-family
CategoryText

How to read this

  • An inherited property only needs writing once on the parent — every child picks it up. Most text properties work this way.
  • A shorthand resets whatever you leave out. Writing background: red alone also wipes a background image you set earlier.
  • When rules collide, the more specific selector wins; only when specificity ties does source order decide.
  • Animate transform and opacity for smoothness. Changing width or top forces the layout to be recalculated.

Frequently asked questions

Q. What is the CSS font property?

Sets several font values at once; anything omitted resets to its default.

Q. How do you write font?

As font: 1rem/1.5 sans-serif;

Q. Is font inherited?

Yes. Set it once on the parent and every child uses the same value without repeating it.

Q. What does the font shorthand set?

font-style, font-weight, font-size, line-height, font-family — and anything you leave out resets to its default.

Properties in the same group

Reference docs