Computer >> Computer tutorials >  >> Programming >> CSS

Setting Line Height using CSS


To set line height, use the line-height property. Followng are the property values −

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

Example

Let us now see an example −

<!DOCTYPE html>
<html>
<head>
<style>
div {
   line-height: 1.9;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<div>
<p>This is demo text.<br>
This is another demo text.
</p>
</div>
</body>
</html>

Output

Setting Line Height using CSS

Example

Let us now see another example −

<!DOCTYPE html>
<html>
<head>
<style>
div {
   line-height: 200%;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<div>
<p>This is demo text.<br>
This is another demo text.
</p>
</div>
</body>
</html>

Output

Setting Line Height using CSS