The code below shows you how to specify the line-height of a paragraph using a number value with CSS.
<!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>Web Development Tutorials.com</title>
<style type="text/css">
p.one
{
line-height: 0.5;
}
p.two
{
line-height: 2;
}
</style>
</head>
<body>
<p>
The default line-height in most web browsers is "1". The line-height of this paragraph is "1".
The default line-height in most web browsers is "1". The line-height of this paragraph is "1".
The default line-height in most web browsers is "1". The line-height of this paragraph is "1".
</p>
<p>
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>
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 code above creates the images below.
The default line-height in most web browsers is "1". The line-height of this paragraph is "1". The default line-height in most web browsers is "1". The line-height of this paragraph is "1". The default line-height in most web browsers is "1". The line-height of this paragraph is "1".
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 text editor below to practice what you have learned.