CSS line-height Property

CSS line-height property set the height for in-line element.

Usages

The following table outline the usages and version history of this property.

Default value: normal
Applies to: All elements
Inherited: Yes
Version: CSS1
JavaScript Syntax: object.style.lineHeight = "22px"

Syntax

Here is a syntax for the CSS line-height property

line-height: normal | number | length | percentage |initial | inherit;

Property Values

The following table describes the values of this property.

Value Description
normal default. Browser set normal height for an element
number Specifies the number value, that multiplied by the element font size
length Specifies the fixed value expressed in px, pt, em etc.
percentage Specifies the percentage value to set line height
initial Sets default value of this property
inherit Inherits this property from its parent element

Examples

The example below shows to sets line height such as normal, number, length, percentage values.

p.one {
  line-height: normal;
}
p.two {
  line-height: 2;
}
p.three {
  line-height: 28px;
} 
p.four {
  line-height: 170%;
}

Run it...   »

Browser Compatibility

  • Google Chrome 1+
  • Mozilla Firefox 1+
  • Internet Explorer 4+
  • Opera 7+
  • Safari 1+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.