line-height Attribute | lineHeight Property

DHTML, HTML, & CSS

line-height Attribute | lineHeight Property


Sets or retrieves the distance between lines in the object.

Syntax

HTML{ line-height: sHeight }
Scriptingobject.style.lineHeight [ = sHeight ]

Possible Values

sHeight String that specifies one of the following values:
normalDefault height.
heightFloating-point number, followed by an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). For more information about the supported length units, see CSS Length Units.
percentageInteger, followed by a %. The value is a percentage of the height of the parent object.

The property is read/write with a default value of normal; the cascading style sheets (CSS) attribute is inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

Line height is the distance between the descender of the font and the top of the internal leading of the font. A negative line height is allowed to achieve various shadowing effects.

If a formatted line contains more than one object, the maximum line height applies. In this case, negative values are not allowed.

Internet Explorer 3.0 supports the line-height attribute through the font attribute.

Example

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.

Sample Code

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

This feature requires Microsoft® Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

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>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, currentStyle, custom, DD, 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

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.