'white-space' Example : white space « CSS Attributes and Javascript Style Properties « HTML CSS Reference






'white-space' Example

    
<html>
<body>
<div id="myDiv" style="background:beige; width:400px;">
   Line1.<br>
   This sentence has line 1
   line 2
   and    
   <br>
   <br>
   <br>
   <br>
   <br>

   line 3 
   <br>
   This is a regular block of text.
</div>
<br>
<button onclick="myDiv.style.whiteSpace='normal';">Set whiteSpace property to:normal</button>
<button onclick="myDiv.style.whiteSpace='pre';">Set whiteSpace property to: pre</button>
</body>
</html>

    
      
      








Related examples in the same category

1.'white-space' Syntax and Note
2.'white-space' Possible Values
3.'white-space' is applied to