<pre> ... </pre>
Available in versions: 2.0, 3.2, 4.0
The <pre> tag is used to display pre-formatted text.
The output will mimic exactly how the text is rendered inside the pre element
including white space, tabs, and line breaks.
This allows you to maintain the appearance of data in rows and columns, or have extra
white spaces in text such as poems.
Perhaps one of the most common uses of this tag is to display computer code and output.
The browser will display the text in a mono spaced font.
However, you can use style sheets, including the style attribute, to effect the
appearance of the text to suit your desires.
The following tags may not appear inside a pre element: big, img, object,
small, sub, and sup.
Therefore, images (which require a img tag) cannot appear in a pre.
The closing tag is mandatory.
Core Attributes
class
dir
id
lang
onclick
ondblclick
onkeydown
onkeypress
onkeyup
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
style
title
Attributes
width deprecated 4.0
The width attribute is used to set the maximum number of characters that can
be displayed on one line.
This attribute is deprecated effective with version 4.0.
However, most browsers continue to recognize this attribute.
The example is shown twice, with and without the use of style sheets.
(Note that HTML does not show the extra white spaces that are present in the code.)
Code without style:
<pre>
function CheckFrames()
{
var strPage, strURL
strPage = location.pathname + location.search
strURL = location.protocol + "//" + location.hostname +
"/index.asp?page=" + escape(strPage)
if ((window.name != "body") || (window.parent.name != "frameset") ||
(window.parent.parent.parent != window.parent.parent))
{
window.top.location.replace(strURL)
}
}
</pre>
Code with style:
<pre style="font-family:arial; color:red; font-size:12px;">
function CheckFrames()
{
var strPage, strURL
strPage = location.pathname + location.search
strURL = location.protocol + "//" + location.hostname +
"/index.asp?page=" + escape(strPage)
if ((window.name != "body") || (window.parent.name != "frameset") ||
(window.parent.parent.parent != window.parent.parent))
{
window.top.location.replace(strURL)
}
}
</pre>
Output without style:
Output with style:
Copyright 2000 by Infinite Software
Solutions, Inc.
Trademark Information
|