Line-height in CSS determines the vertical spacing between lines of text within an element. It affects the overall height of the element, influencing the appearance of text blocks.
How to Use Line-Height
You can set the line-height property using different values:
1. Numeric Value (Unitless)
- This is the most common method.
- The value represents a multiplier of the font size.
- A value of
1means the line height is equal to the font size. - A value of
1.5means the line height is 1.5 times the font size.
p {
font-size: 16px;
line-height: 1.5; /* Line height will be 24px (16 * 1.5) */
}
2. Length Value
- You can specify the line height in pixels, ems, rems, or other length units.
p {
font-size: 16px;
line-height: 24px;
}
3. Percentage Value
- The line height is calculated as a percentage of the font size.
p {
font-size: 16px;
line-height: 120%; /* Line height will be 19.2px (16 * 1.2) */
}
4. Keyword normal
- This is the default value.
- The browser determines the line height based on the font and user settings.
p {
line-height: normal;
}
Example
body {
font-family: Arial, sans-serif;
font-size: 16px;
}
p {
line-height: 1.6; /* Adjust this value as needed */
}
Visual Demonstration

Tips for Using Line-Height
- Readability: A line height of around 1.5 to 1.8 is often considered good for readability.
- Typography: The ideal line height depends on the font, font size, and overall design.
- Vertical Rhythm: Consistent line height can create a visually pleasing rhythm in your layout.
- Responsive Design: Consider using relative units (em or rem) for line height to maintain proportions across different screen sizes.
Additional Notes
- Vertical Alignment: Line-height also affects the vertical alignment of text within its container.
- Browser Compatibility: While line-height is well supported, there might be slight variations in rendering across different browsers.
By understanding and effectively using line-height, you can significantly improve the readability and visual appeal of your web content.