How to specify the space between lines with the line-height property with CSS
The code example below shows you how to specify the space between lines with the line-height property 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: 90%; }
p.two
{ line-height: 200%; }
</style>
</head>
<body>
<p>
This is a paragraph with a standard line-height.
The default line height in most web browsers is about 110% to 120%.
The default line height in most web browsers is about 110% to 120%.
The default line height in most web browsers is about 110% to 120%.
The default line height in most web browsers is about 110% to 120%.
</p>
<p class="one">
This paragraph has a line-height of 90%. This paragraph has a line-height of 90%.
This paragraph has a line-height of 90%. This paragraph has a line-height of 90%.
This paragraph has a line-height of 90%. This paragraph has a line-height of 90%.
This paragraph has a line-height of 90%. This paragraph has a line-height of 90%.
This paragraph has a line-height of 90%. This paragraph has a line-height of 90%.
</p>
<p class="two">
This paragraph has a line-height of 200%. This paragraph has a line-height of 200%.
This paragraph has a line-height of 200%. This paragraph has a line-height of 200%.
This paragraph has a line-height of 200%. This paragraph has a line-height of 200%.
This paragraph has a line-height of 200%. This paragraph has a line-height of 200%.
This paragraph has a line-height of 200%. This paragraph has a line-height of 200%.
</p>
</body>
</html>
The code example above makes the 3 paragraphs below.
This is a paragraph with a standard line-height. The default line height in most web browsers is about 110% to 120%. The default line height in most web browsers is about 110% to 120%. The default line height in most web browsers is about 110% to 120%. The default line height in most web browsers is about 110% to 120%.
This paragraph has a line-height of 90%. This paragraph has a line-height of 90%. This paragraph has a line-height of 90%. This paragraph has a line-height of 90%. This paragraph has a line-height of 90%. This paragraph has a line-height of 90%. This paragraph has a line-height of 90%. This paragraph has a line-height of 90%. This paragraph has a line-height of 90%. This paragraph has a line-height of 90%.
This paragraph has a line-height of 200%. This paragraph has a line-height of 200%. This paragraph has a line-height of 200%. This paragraph has a line-height of 200%. This paragraph has a line-height of 200%. This paragraph has a line-height of 200%. This paragraph has a line-height of 200%. This paragraph has a line-height of 200%. This paragraph has a line-height of 200%. This paragraph has a line-height of 200%.
Use the text editor below to practice what you have learned.