Skip to: content, navigation

xmp (HTML element)

Spec
Depr. Empty Version
Yes No HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Partial Partial Partial Partial Partial

Syntax

<xmp>
</xmp>

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:

Example of xmp 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>

Use this for…

Text content.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial 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).

User-contributed notes

ID:
#1
Contributed:
by brothercake
Date:
Thu, 09 Oct 2008 07:24:11 GMT

The PRE element does NOT treat markup characters as literal text, it treat them as markup; the XMP element one the other hand does treat them as literal text. That's the major practical difference between them, and makes XMP useful for development - for eg test output from PHP that may contain markup, where you want to see the markup as code.

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.

Related Products

Search