Home·CSS properties

font-family

Text

Sets the typeface; the browser falls through the list, so end with a generic family.

How to write itfont-family: sans-serif;
Common valuessans-serif, serif, monospace, system-ui
InheritedYes — children receive it
Part offont
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-family property?

Sets the typeface; the browser falls through the list, so end with a generic family.

Q. How do you write font-family?

As font-family: sans-serif; Common values include sans-serif, serif, monospace, system-ui.

Q. Is font-family inherited?

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

Q. Which shorthand sets font-family?

font can set it in one line.

Properties in the same group

Reference docs