<xmp>

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

概括

¥Summary

<xmp> HTML 元素呈现开始标签和结束标签之间的文本,而不解释中间的 HTML 并使用等宽字体。HTML2 规范建议呈现的宽度应足以允许每行 80 个字符。

¥The <xmp> HTML element renders text between the start and end tags without interpreting the HTML in between and using a monospaced font. The HTML2 specification recommended that it should be rendered wide enough to allow 80 characters per line.

注意:不要使用该元素。

¥Note: Do not use this element.

  • 它自 HTML3.2 起已被弃用,并且没有以一致的方式实现。它已从当前的 HTML 中完全删除。
  • 使用 <pre> 元素,或者,如果语义足够,则使用 <code> 元素。请注意,你需要将“<”字符转义为“&lt;”,将“&”字符转义为“&amp;”,以确保它们不会被解释为标记。
  • 通过使用 monospace 作为 font-family 属性的通用字体值应用适当的 CSS 样式,也可以在任何元素上获得等宽字体。

属性

¥Attributes

该元素除了所有元素共有的 全局属性 之外没有其他属性。

¥This element has no other attributes than the global attributes, common to all elements.

DOM 接口

¥DOM interface

该元素实现 HTMLElement 接口。

¥This element implements the HTMLElement interface.

规范

Specification
HTML Standard
# xmp

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also