How to specify the space between lines using number values with the line-height attribute with CSS
The below HTML and CSS code example shows you how to specify the space between lines using number values with the line-height attribute 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>this is the title of the web page</title>
<style type="text/css">
</style>
</head>
<body>
<p style="line-height: 1;">
This paragraph has a line-height of "1". The default line-height in most web browsers is "1".
This paragraph has a line-height of "1". The default line-height in most web browsers is "1".
</p>
<p style="line-height: 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 "0.5".
</p>
<p style="line-height: 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". This paragraph has a line-height of "2".
</p>
</body>
</html>
The XHTML and CSS code above makes the paragraphs below:
This paragraph has a line-height of "1". The default line-height in most web browsers is "1". This paragraph has a line-height of "1". The default line-height in most web browsers 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.
You can use the practice CSS and XHTML editor below to practice setting the line-height of a line with CSS.