white-space: pre : white space « CSS « HTML / CSS






white-space: pre

   

<!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>The effect of different values of white-space</title>
  <style type="text/css">
    body {
      font: 12px/1.5em Georgia, serif;
    }
    h1 {
      font: bold 12px/1.5em Georgia, serif;
      margin: 0.75em 0 0 0;
    }
    div.pre p {
      white-space: pre;
    }

  </style>
</head>
<body>
<div>
  <h1>white-space: normal</h1>
  <p>  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>

</div>
<div class="pre">
  <h1>white-space: pre</h1>
  <p>  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>
</div>
<div class="nowrap">
  <h1>white-space: nowrap</h1>
  <p>  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>
</div>
<div class="pre">
  <h1>white-space: pre</h1>
  <p>  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>
</div>
</body>
</html>

   
    
  








Related examples in the same category

1.The white-space Property
2.'white-space' Example
3.white-space: normal
4.white-space:pre; white-space:nowrap;
5.white-space: nowrap, white-space: pre