HTML Tag Reference - HTML tag <pre>








This <pre> element renders a block of text in a fixed-width or monospaced font.

Browser compatibility

<pre> Yes Yes Yes Yes Yes

What's new in HTML5

The "width" attribute is deprecated in HTML5.

Attribute

Attribute Value Description
width number Not supported in HTML5.
Set the maximum number of characters per line




Global Attributes

The <pre> tag supports the Global Attributes in HTML.

Event Attributes

The <pre> tag supports the Event Attributes in HTML.

Default CSS Settings

pre {
    display: block;
    font-family: monospace;
    white-space: pre;
    margin: 1em 0;
}




Example

A demo showing how to use <pre> tag.

<html>
<body>
     <pre>No nonbreaking spaces (&amp;nbsp;) 
     are necessary in a pre element.</pre>
</body>
</html>

Click to view the demo