The Preformatted Text element presents blocks of text in fixed-width font, and so is suitable for text that has been formatted on screen, or formatted for a mono-spaced font.
The <PRE>
element may be used with the optional WIDTH attribute, which is a HTML Level 1 feature. The WIDTH
attribute specifies the maximum number of characters for a line and allows the HTML user agent to determine which of its available fonts to use and how to indent the text (if at all). If the WIDTH
attribute is not present, a width of 80 characters is assumed. Where the WIDTH
attribute is supported, widths of 40, 80 and 132 characters should be presented optimally, with other widths being rounded up.
Within preformatted text, any line breaks within the text are rendered as a move to the beginning of the next line. The <P>
element should not be used, but if it is found, it should be rendered as a move to the beginning of the next line. It is possible to use Anchor elements and character highlighting elements are allowed. Elements that define paragraph formatting (headings, address, etc.) must not be used. The horizontal tab character (encoded in US-ASCII and ISO-8859-1 as decimal 9) represents a special formatting case. It should be interpreted as the smallest positive nonzero number of spaces which will leave the number of characters so far on the line as a multiple of 8. (However, despite being allowed, its use is not recommended.)
NOTE: It is at the discretion of individual browsers how to render preformatted text and where "beginning of a new line" is to be implied, the browser can render that new line indented if it sees fit.
Example of use:
<PRE WIDTH="80">
This is an example of preformatted text.
</PRE>
NOTE : Internet Explorer 4.0 doesn't change the font pitch when different values are given to the WIDTH
attribute.
NOTE: Within a Preformatted Text element, the constraint that the rendering must be on a fixed horizontal character pitch may limit or prevent the ability of the browser to render highlighting elements (such as <B>
, <I>
etc.) specially.
TITLE="informational ToolTip"
The Internet Explorer 4.0 (and above) specific TITLE
attribute is used for informational purposes. If present, the value of the TITLE
attribute is presented as a ToolTip when the users mouse hovers over the <PRE>
section.
LANG="language setting"
The LANG
attribute can be used to specify what language the <PRE>
element is using. It accepts any valid ISO standard language abbreviation (for example "en"
for English, "de"
for German etc.) For more details, see the Document Localisation section for more details.
LANGUAGE="Scripting language"
The LANGUAGE
attribute can be used to expressly specify which scripting language Internet Explorer 4.0 uses to interpret any scripting information used in the <PRE>
element. It can accept values of vbscript
, vbs
, javascript
or jscript
. The first two specify the scripting language as Visual Basic Script, the latter two specify it as using Javascript (the default scripting language used if no LANGUAGE
attribute is set.
CLASS="Style Sheet class name"
The CLASS
attribute is used to specify the <PRE>
as using a particular style sheet class. See the Style Sheets overview for more information and style sheet settings.
STYLE="In line style setting"
As well as using previously defined style sheet settings, the <PLAINTEXT>
element can have in-line stylings attached to it. For example:
<PRE STYLE="{font-style:italic}">Some italic pre-formatted text</PRE>
would display in an italic font. See the Style Sheets section for more details about style sheet settings.
ID="Unique element identifier"
The ID
attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the <PRE>
element for scripting purposes. Any <PRE>
element with an ID
attribute can be directly manipulated in script by referencing its ID
attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
Every <PRE>
element in a document is an object that can be manipulated through scripting. Note that scripting of the <PRE>
element/object is only supported by Internet Explorer 4.0 in its Dynamic HTML object model. Netscape does not support direct scripting of the <PRE>
element at all.
<PRE...>
Properties
As well as supporting all of the standard Dynamic HTML properties (i.e. className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName and title), the <PRE...>
element/object also supports the additional width property, which reflects any settings of the WIDTH
attribute. Details of these can be found in the standard Dynamic HTML properties topics.
<PRE...>
Methods
The <PRE...>
element/object supports all of the standard Dynamic HTML methods (i.e. click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView and setAttribute). Details of these can be found in the standard Dynamic HTML Methods topics.
<PRE...>
Events
The <PRE...>
element/object supports all of the standard Dynamic HTML events (i.e. onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup and onselectstart). Details of these can be found in the standard Dynamic HTML events topics.
© 1995-1998, Stephen Le Hunte
Comments:
file: /Techref/language/html/ib/Block_Level_Elements/pre.htm, 10KB, , updated: 2010/9/15 17:49, local time: 2024/11/5 08:39,
18.118.27.119:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/Techref/language/html/ib/Block_Level_Elements/pre.htm"> <PRE></A> |
Did you find what you needed? |