Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style lineHeight Property

Style lineHeight Property

Style Object Reference The Style object


Definition and Usage

The lineHeight property sets or returns the distance between lines in the text.

Syntax

Sets the lineHeight property:

Object.style.lineHeight="normal|

number

|

length

|

%

|inherit"

Returns the lineHeight property:

Object.style.lineHeight

Value Description
normal Default. Sets a reasonable line spacing.
number Sets a number that is multiplied by the current font size to determine the line spacing.
length Defines the line spacing using units such as px, cm, etc.
% Defines the line spacing as a percentage of the current font size.
inherit The lineHeight property value is inherited from the parent element.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the lineHeight property.

**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".


Example

Example

Changes the height of the lines:

Runoob Tutorial(runoob.com)

This is some text, this is some text. This is some text, this is some text.

This is some text, this is some text. This is some text, this is some text.

This is some text, this is some text. This is some text, this is some text.

This is some text, this is some text. This is some text, this is some text.


Try it »


Style Object Reference The Style object