line-height | NN 4 IE 4 CSS 1 |
Inherited: Yes | |
Sets the height of the inline box (the box holding one physical line of content). Under normal circumstances, the line-height of the tallest font in a line of text or the tallest object governs the line height for that content line. Mainstream browsers have come a long way since the Version 4 wrinkles that frequently made a visual mess out of mixed font sizes and line heights in the same block-level element. |
|
CSS Syntax | |
line-height: normal | number | length | percentage |
|
Value | |
A value of normal lets the browser calculate line spacing for the entire element, thus producing a computed value that can be inherited by nested elements. A number value (greater than zero) acts as a multiplier for the font-size of the current element. Therefore, if a nested element inherits the line-height multiplier from its parent, that multiplier is applied to the current element's font-size setting (the multiplier, not the computed value of the parent, is inherited). A length value assigns an actual value to the inline box height. And a percentage value is a multiplier applied to the font size of the current element. In this case, the computer value can be inherited by nested elements. |
|
Initial Value | |
normal |
|
Example | |
p {line-height: normal} /* Browser default; actual value is inheritable */ p {line-height: 1.1} /* Number value; the number value is inheritable */ p {line-height: 1.1em} /* Length value; the actual value is inheritable */ p {line-height: 110%} /* Percentage value; percentage times font size */ /* is inheritable /* |
|
Applies To | |
All elements. |
|
Object Model Reference | |
[window.]document.getElementById("elementID").style.lineHeight
|