CSS line-height Property


googletag.cmd.push(function() googletag.display('div-gpt-ad-1422003450156-2'); );
CSS line-height Property
❮
Reference
❯
Example
Set the line height for different <div> elements:
div.a
line-height: normal;
div.b
line-height: 1.6;
div.c
line-height:
80%;
div.d
line-height: 200%;
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The line-height
property specifies the
height of a line.
Note: Negative values are not allowed.
Default value: | normal |
---|---|
Inherited: | yes |
Animatable: | yes. Read about animatable Try it |
Version: | CSS1 |
JavaScript syntax: | object.style.lineHeight="30px" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
line-height | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
googletag.cmd.push(function() googletag.display('div-gpt-ad-1493883843099-0'); );
CSS Syntax
line-height: normal|number|length|initial|inherit;
Property Values
Value | Description | Play it |
---|---|---|
normal | A normal line height. This is default | Play it » |
number | A number that will be multiplied with the current font-size to set the line height | Play it » |
length | A fixed line height in px, pt, cm, etc. | Play it » |
% | A line height in percent of the current font size | Play it » |
initial | Sets this property to its default value. Read about initial | Play it » |
inherit | Inherits this property from its parent element. Read about inherit |
More Examples
Example
Set the line height in pixels and centimeters for different <div> elements:
div.a
line-height: 10px;
div.b
line-height: 30px;
div.c
line-height:
0.5cm;
div.d
line-height: 1cm;
Try it Yourself »
Example
Set the line height as a number for different <div> elements:
div.a
line-height: 0.5;
div.b
line-height: 1.6;
div.c
line-height: 2;
Try it Yourself »
Related Pages
CSS tutorial: CSS Text
HTML DOM reference:
lineHeight property
❮
Reference
❯