line-height property
Sets or retrieves the distance between lines in the object.
![]() |
Syntax
line-height: normal | height | percentage
Property values
normal-
Default. Default height.
height-
Floating-point number, followed by an absolute units designator (
cm,mm,in,pt, orpc) or a relative units designator (em,ex, orpx). For more information about the supported length units, see CSS Values and Units Reference. percentage-
Integer, followed by a percent sign (%). The value is a percentage of the height of the parent object.
CSS information
| Applies To | All elements |
|---|---|
| Media | visual |
| Inherited | no |
| Initial Value |
Standards information
- CSS 2.1, Section 5.4.8
Remarks
Line height is the distance between the descender of the font and the top of the internal leading of the font.
If a formatted line contains more than one object, the maximum line height applies. In this case, negative values are not allowed.
Microsoft Internet Explorer 3.0 supports the line-height attribute through the font attribute.
Examples
The following examples use the line-height attribute and the line-height property to control the height of paragraph lines.
This example uses p and blockquote as selectors in an embedded (global) style sheet to change the distance between the lines in all p and blockquote objects.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/line-height.htm
<STYLE>
P { line-height:8mm}
BLOCKQUOTE { line-height:4mm }
</STYLE>
This example uses inline scripting to set the distance between lines when an onmouseover event occurs.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/lineHeight.htm
<DIV STYLE="font-size:14" onmouseover="this.style.lineHeight='6mm'"> : </DIV>
See also
Send comments about this topic to Microsoft
Build date: 11/29/2012
