October 22, 2011

Preformatted Text Tag, <pre></pre>

Preformatted text tag marks the text as "preformatted". All the spaces and returns are rendered exactly as you type them. Preformatted text is displayed in a fixed width font, meaning to say, all characters and spaces are the same width. Open your text editor now and key in the next code to see the effect of </pre> tag in action.

<html>
<head>

<title>PRE Tag</title>
</head>

<body>

<pre>
This text is preformatted using the pre tag.
Below is a CSS rule.

p{background:yellow;
 color:blue;
    font-weight:bolder;
    font-size:x-large;
    }
</pre>

</body>
</html>

The previous code produces this page in Mozilla Firefox:
Click to enlarge

TIP: When displaying computer codes on your webpage it is advisable to use the </pre> tag.

0 comments: