Style lineHeight Property
Example
Set the line height for a <div> element:
document.getElementById("myDiv").style.lineHeight = "3";
Try it yourself »
Definition and Usage
The lineHeight property sets or returns the distance between lines in a text.
Browser Support
The lineHeight property is supported in all major browsers.
Syntax
Return the lineHeight property:
object.style.lineHeight
Set the lineHeight property:
object.style.lineHeight="normal|number|length|%|initial|inherit"
Property Values
Value | Description |
---|---|
normal | Normal line height is used. This is default |
number | A number that will be multiplied with the current font size to set the line height |
length | Defines the line height in length units |
% | Defines the line height in % of the current font size |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | normal |
---|---|
Return Value: | A String, representing the distance between lines in the text |
CSS Version | CSS1 |
More Examples
Example
Return the line height of a <div> element:
alert(document.getElementById("myDiv").style.lineHeight);
Try it yourself »
Related Pages
CSS tutorial: CSS Text
CSS reference: line-height property
Style Object