font-size
Text
The text size; rem multiplies the root size, so it follows the reader’s zoom setting.
| How to write it | font-size: 16px; |
|---|---|
| Common values | 16px, 1rem, clamp(1rem, 2vw, 1.5rem) |
| Inherited | Yes — children receive it |
| Part of | font |
| Category | Text |
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-size property?
The text size; rem multiplies the root size, so it follows the reader’s zoom setting.
Q. How do you write font-size?
As font-size: 16px; Common values include 16px, 1rem, clamp(1rem, 2vw, 1.5rem).
Q. Is font-size inherited?
Yes. Set it once on the parent and every child uses the same value without repeating it.
Q. Which shorthand sets font-size?
font can set it in one line.