4 out of 6 rated this helpful - Rate this topic

line-height property

Sets or retrieves the distance between lines in the object.

CSS 2.1, Section 5.4.8

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, or pc) or a relative units designator (em, ex, or px). 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 ToAll elements
Mediavisual
Inheritedno
Initial Value

Standards information

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

CSSStyleDeclaration
currentStyle
defaults
runtimeStyle
style

 

 

Send comments about this topic to Microsoft

Build date: 11/29/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.