HTML Pre tag


Preformatted text:
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and
line breaks

Definition and Usage

The <pre> tag defines preformatted text.
Text in a pre element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks.

Browser Support

The <pre> tag is supported in all major browsers.

Differences Between HTML and XHTML

The "width" attribute of the pre element was deprecated in HTML 4.01, and is not supported in XHTML 1.0 Strict DTD.

Tips and Notes

Tip: Use the pre element to display computer code!

Optional Attributes

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
width number Deprecated. Use styles instead.
Specifies the maximum number of characters per line

Standard Attributes

id, class, title, style, dir, lang, xml:lang, xml:space

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
HTML Pre tag Reviewed by 1000sourcecodes on 21:24 Rating: 5
Powered by Blogger.