Web - Line height and spacing
Code Life
By Pierre Marsaa
Understanding Line Height
Line height (or line spacing) controls the vertical space between lines of text. It makes text more readable when set properly.
In CSS, we use the line-height property to control this spacing:
↗️
Loading editor...
↶
↷
Line height can be specified in several ways:
- Unitless number (recommended): line-height: 1.5;
- Pixel: line-height: 24px;
- Percentage: line-height: 150%;
- Keyword: line-height: normal;
Best Practice
Using unitless values (like 1.5) is recommended because they're inherited proportionally. For good readability, most text should have a line-height between 1.4 and 1.8.
Verify