Style lineHeight Property

Example

Set the line height for a <div> element:

document.getElementById("myDiv").style.lineHeight = "3";
Try it Yourself »

Description

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


Browser Support

Property
lineHeight Yes Yes Yes Yes Yes

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


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.