HTML <pre> tag
Example
Preformatted text:
<pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both
spaces and
line breaks
</pre>
|
Try it yourself!
|
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 |
TF |
Standard Attributes
id, class, title, style, dir, lang, xml:lang, xml:space |
For a full description, go to Standard
Attributes.
Event Attributes
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup |
For a full description, go to Event Attributes.
Learn XML with <oXygen/> XML Editor - Free Trial!
|
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|