CSS line-heightProperty
Example
Set line height using percentage:
p.small {line-height:90%}
p.big {line-height:200%}
Try it Yourself »
More examples at the bottom of this page.
Property definition and usage instructions
Set line height as a percentage: .
Note:Negative values are not allowed
| Default value: | normal |
|---|---|
| Inherited: | yes |
| version: | CSS1 |
| JavaScript Syntax: | object.style.lineHeight="2" |
Browser Support
The numbers in the table indicate the first browser version that supports this property.
| Property | |||||
|---|---|---|---|---|---|
| line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Property value
| Value | Description |
|---|---|
| normal | Default. Sets a reasonable line spacing. |
| number | Sets a number, which is multiplied by the current font size to set the line spacing. |
| length | Sets a fixed line spacing. |
| % | Line spacing based on a percentage of the current font size. |
| inherit | Specifies that the value of the line-height property should be inherited from the parent element. |
More Examples
This example demonstrates how to use pixel values to set the line spacing in paragraphs.
This example demonstrates how to use a number to set the line spacing in paragraphs.
Related Articles
CSS Tutorial:CSS Text
other extensions