line-height
Text
The line spacing; a unitless value such as 1.5 inherits more safely.
| How to write it | line-height: 1.5; |
|---|---|
| Common values | 1.5, normal, 24px |
| 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 line-height property?
The line spacing; a unitless value such as 1.5 inherits more safely.
Q. How do you write line-height?
As line-height: 1.5; Common values include 1.5, normal, 24px.
Q. Is line-height inherited?
Yes. Set it once on the parent and every child uses the same value without repeating it.
Q. Which shorthand sets line-height?
font can set it in one line.