0 out of 1 rated this helpful - Rate this topic

line-height Attribute | lineHeight Property

Gets or sets the distance between lines in the object.

Syntax

CSS { line-height : sHeight }
Scripting [ sHeight = ] object.style.lineHeight

Possible Values

sHeight String that specifies or receives one of the following 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 Length Units Reference.
percentage
Integer, followed by a percent sign (%). The value is a percentage of the height of the parent object.

The property is read/write for all objects except the following, for which it is read-only: currentStyle. The property has a default value of normal. The Cascading Style Sheets (CSS) attribute is not inherited.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are supported in IE7 Standards mode and IE5 (Quirks) mode only. For more information, see About Dynamic Properties and Defining Document Compatibility.

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 lineHeight 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.


<STYLE>
    P { line-height:8mm}
    BLOCKQUOTE { line-height:4mm }
</STYLE>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/line-height.htm

This example uses inline scripting to set the distance between lines when an onmouseover event occurs.


<DIV STYLE="font-size:14" onmouseover="this.style.lineHeight='6mm'">
:
</DIV>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/lineHeight.htm

Standards Information

This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1).

Applies To

A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, CSSStyleDeclaration, currentStyle, CUSTOM, DD, defaults, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, hn, HTML, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, runtimeStyle, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, CSSCurrentStyleDeclaration Constructor, CSSRuleStyleDeclaration Constructor, CSSStyleDeclaration Constructor
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ