Examples of font-size and line-height : line height « CSS « HTML / CSS






Examples of font-size and line-height

  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Examples of font-size and line-height</title>
  <style type="text/css">
    body {
      font-size: 12px;
    }
    h1 { 
      font-size: 1em; 
      line-height: 1.5;
      font-weight: bold;
      margin: 1em 0 0 0;
    }
    p { 
      margin: 0;
      width: 33em;
    }
    p.one { 
      font-size: 1em;
      line-height: 1.5em;
    }
    p.two {
      font-size: 1.2em;
      line-height: 1.5em;
    }
  </style>
</head>
<body>
  <h1>Size: 1em, line-height: 1.5em</h1>
  <p class="one">
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. </p>
  <h1>Size: 1.2em, line-height: 1.5em</h1>
  <p class="two">
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. </p>
  
</body>
</html>

   
  








Related examples in the same category

1.'line-height' Example
2.line-height: 1.5
3.line-height: 1.4em
4.line-height: 75%
5.line-height: 1.5;
6.line-height: 1.5em;
7.line-height: 75%;
8.line height:3em
9.Setting line heights
10.Line-height settings
11.line-height:normal;line-height:18px;line-height:1.5em;line-height:1.9ex;
12.line-height:1.5em;
13.Interlinear space
14.Set line height to 1em
15.Set line height to 1.5
16.line-height: 150%; assigns 150% of the font-size to line-height.
17.Padding sets apart text to emphasize it and line-height
18.Proportional line heights
19.Different line height with various measurements