Style lineHeight attribute
- Previous Page letterSpacing
- Next Page listStyle
- Go to Parent Level HTML DOM Style Object
Definition and usage
lineHeight
Sets or returns the distance between lines in the text (line spacing).
See also:
CSS Tutorial:CSS Text
CSS Reference Manual:line-height attribute
Example
Example 1
Set the line height of the <div> element:
document.getElementById("myDiv").style.lineHeight = "3";
Example 2
Return the line height of the <div> element:
alert(document.getElementById("myDiv").style.lineHeight);
Syntax
Return lineHeight attribute:
object.style.lineHeight
Set lineHeight attribute:
object.style.lineHeight = "normal|number|length|%|initial|inherit"
Attribute value
Value | Description |
---|---|
normal | Use the normal line height. Default. |
number | Set line height by multiplying the number by the current font size. |
length | Define line height with a length unit. |
% | Define line height as a percentage of the current font size. |
initial | Set this attribute to its default value. See initial. |
inherit | This attribute inherits from its parent element. See inherit. |
Technical details
Default value: | normal |
---|---|
Return value: | A string indicating the distance between lines in the text. |
CSS Version: | CSS1 |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page letterSpacing
- Next Page listStyle
- Go to Parent Level HTML DOM Style Object