Use pre element to work with Preformatted Content

Description

In pre element whitespace is not collapsed and formatting is preserved. This can be useful when the original formatting of a section of content is significant.

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

Example

The formatting in programming languages, for example, is usually significant.


<!DOCTYPE HTML>
<html>
<head>
</head><!-- ww w.j  a va 2s  .  c o  m-->
<body>
  <pre>
    <code>
            var  fruits = ["XML",  "HTML", "CSS", "Java"];
            for (var i = 0; i < fruits.length; i++)   {
                document.writeln("I like  "  + fruits[i]);
            }
        </code>
  </pre>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed