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…

Unlike pre, xmp element treats markup characters as literal text. This makes xmp useful for development - e.g.for testing output from PHP that may contain markup, where you want to see the markup as code.

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

Related Products