CSS line-height Property
Sets the amount of space between lines of text determining the height of line boxes
Syntax
line-height: normal | <number> | <length> | <percentage>;Values
| Value | Description |
|---|---|
| normal | Browser default (usually ~1.2) |
| <number> | Multiplier of the font size (unitless, recommended) |
| <length> | Fixed line height |
| <percentage> | Percentage of font size |
Example
body {
line-height: 1.6;
}
h1 {
line-height: 1.2;
}Understanding CSS line-height
The CSS line-height property sets the amount of space between lines of text determining the height of line boxes. As part of the Typography module in CSS, it is one of the most commonly used properties for controlling the visual presentation of web pages.
You can set line-height to values such as normal, <number>, <length>, <percentage>, among others. Each value changes how the browser renders the affected element, giving you fine-grained control over your page layout and design. Choosing the right value depends on the specific design requirements of your project.
Common use cases for the line-height property include responsive web design, component-based layouts, and creating visually consistent interfaces across devices. It works closely with related properties like font-size, font, vertical-align to achieve complex styling effects. Understanding how these properties interact helps you write cleaner, more maintainable stylesheets.
Browser support for line-height is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. For older browsers, consider using fallback values or progressive enhancement strategies. The property can also be set dynamically via JavaScript using element.style.lineHeight or the CSS custom properties (variables) approach for theming.
Related Properties
font-sizeSets the size of the font for text content
fontShorthand for font-style, font-variant, font-weight, font-stretch, font-size, line-height, and font-family
vertical-alignSets the vertical alignment of an inline, inline-block, or table-cell element
letter-spacingSets the horizontal spacing between text characters
Explore More CSS Properties
Browse our complete reference of 251 CSS properties with syntax, examples, and tips.