xmp (HTML element)
Example
An example of the
xmp showing a stock inventory as it might appear on an
80-column display:
<xmp> Stock ID Description Price Quantity in Stock -------- ----------- ----- ----------------- 116 Inflatable Armchair 21.50 13 119 Walkie Talkie 40.20 44 </xmp>
- Type
- block-level element
- Contains
- inline elements only
- Contained by
- block-level elements
Description
The xmp
element was originally intended for marking up example text as it might
appear on 80-column display units. As such displays are no longer the norm
and have gone the way of teletype machines and sound as archaic as
referring to VDUs (Visual Display Units), it may not be a complete
surprise to hear that this is no longer an element that is recommended. It
is deprecated, and only partially supported.
xmp
is similar to pre in that
it honors carriage returns, spaces, tabs and treats markup characters as
literal text. It is also a block-level element and will therefore create a line
break before the opening <xmp> and the closing
</xmp>.
The example shown would render as follows:

Use this for…
Text content.
Compatibility
| IE | 5.5 | Partial |
|---|---|---|
| 6.0 | Partial | |
| 7.0 | Partial | |
| Firefox | 1.0 | Partial |
| 1.5 | Partial | |
| 2.0 | Partial | |
| Safari | 1.3 | Partial |
| 2.0 | Partial | |
| 3.0 | Partial | |
| Opera | 9.2 | Partial |
| 9.5 | Partial |
Partial browser
support for xmp (all browsers tested rendered in fixed
width font and honored white space formatting, but none limited the
display to 80 columns).
Related Reading
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

