CSS dimension properties allow you to control the height and width of an HTML element. It also allows you to control the spacing between 2 lines.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>this is the title of the web page</title>
<style type="text/css">
p.small {line-height: 0.5;}
p.big {line-height: 2;}
</style>
</head>
<body>
<p>
The default line height in most browsers is 1.
This is a paragraph with a standard line-height. This is a paragraph with a standard line-height.
This is a paragraph with a standard line-height. This is a paragraph with a standard line-height.
This is a paragraph with a standard line-height. This is a paragraph with a standard line-height.
</p>
<p class="small">
This paragraph has a line-height of 0.5. This paragraph has a line-height of 0.5.
This paragraph has a line-height of 0.5. This paragraph has a line-height of 0.5.
This paragraph has a line-height of 0.5. This paragraph has a line-height of 0.5.
</p>
<p class="big">
This paragraph has a line-height of 2. This paragraph has a line-height of 2.
This paragraph has a line-height of 2. This paragraph has a line-height of 2.
This paragraph has a line-height of 2. This paragraph has a line-height of 2.
</p>
</body>
</html>
The above XHTML and CSS code produces the images below:
The default line height in most browsers is 1. This is a paragraph with a standard line-height. This is a paragraph with a standard line-height. This is a paragraph with a standard line-height. This is a paragraph with a standard line-height. This is a paragraph with a standard line-height. This is a paragraph with a standard line-height.
This paragraph has a line-height of 0.5. This paragraph has a line-height of 0.5. This paragraph has a line-height of 0.5. This paragraph has a line-height of 0.5. This paragraph has a line-height of 0.5. This paragraph has a line-height of 0.5.
This paragraph has a line-height of 2. This paragraph has a line-height of 2. This paragraph has a line-height of 2. This paragraph has a line-height of 2. This paragraph has a line-height of 2. This paragraph has a line-height of 2.
Use the CSS and XHTML editor below to practice making paragraphs with different line-heights.