<pre> for Preformatted Content

The pre element changes the way that the browser deals with whitespace, so that whitespace is not collapsed and formatting is preserved.

The pre element can be useful when you use it with the code element.

 
<!DOCTYPE HTML> 
<html> 
<head> 
<title>Example</title> 
</head> 
    <body> 
        <pre>
            <code> 
                var items = ["A", "B", "C", "D"]; 
                for (var i = 0; i < items.length; i++) { 
                    document.writeln("I like " + items[i]); 
                } 
            </code>
        </pre> 
    </body> 
</html>
  
Click to view this demo.
Home 
  HTML CSS Book 
    HTML  

Related: