已废弃
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
概述
<xmp>
标签之间的内容不会被当作文档内容解析,而会被用等宽字体直接呈现。HTML2 规范建议,本标签中的内容应该具有足够容纳每行80个字母的宽度。
提示: 请不要使用这个元素。
- 从HTML3.2开始反对使用本元素,同时它不再会在之后版本内被推荐使用。在HTML5规范内,本元素已经完全被移除。
- 建议您使用
<pre>
元素,如果有特殊需求,您可以使用<code>
元素。需要您注意的是,使用元素的时候,需要将内容中的"<"转义为"<",以防止被浏览器当作正常标签解析。 - 通过CSS样式表将
font-family
属性的值设置成为generic-font,可以让任何其他任何标签获得等宽字体的样式。
属性
该元素支持全局属性。
DOM 接口
本元素支持HTMLElement
接口。
兼容性提示: Gecko 1.9.2内核及更高版本已经兼容本元素,在火狐浏览器内本元素支持使用HTMLSpanElement
接口。
浏览器兼容性
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
xmp | Chrome Full support Yes | Edge Full support Yes | Firefox
Full support
Yes
| IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android
Full support
Yes
| Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.
- See implementation notes.
- See implementation notes.
参阅
- 可以使用
<pre>
和<code>
元素来代替本元素。 -
<plaintext>
和<listing>
元素和<xmp>
类似,都已被废弃。.