CSS Property Value How to - white-space:pre;








Question

We would like to know how to white-space:pre;.

Answer


<!--from   w w  w .ja  v a2 s.com-->
<html>

<head>
  
  <style>
.pre {white-space:pre;}
.nowrap {white-space:nowrap;}

  </style>
</head>

<body>
<h1>white-space</h1>
<p class="normal">Here is some text inside a 
paragraph designed to test the 
white-space property of CSS.</p>
<p class="pre">  Here 
    is 
      some 
         text inside a paragraph 
designed to test the white-space property of
            C   S   S. </p>

<p class="nowrap">Here is some text inside a paragraph designed to test the white-space property of CSS. Here is some text inside a paragraph designed to test the white-space property of CSS.</p>
</body>
</html>

The code above is rendered as follows: