<plaintext>:纯文本元素(已弃用)

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.

<plaintext> HTML 元素将开始标记后面的所有内容呈现为原始文本,忽略任何后续 HTML。没有结束标记,因为它后面的所有内容都被视为原始文本。

¥The <plaintext> HTML element renders everything following the start tag as raw text, ignoring any following HTML. There is no closing tag, since everything after it is considered raw text.

警告:不要使用该元素。

¥Warning: Do not use this element.

  • 自 HTML 2 以来,<plaintext> 已被弃用,并且并非所有浏览器都实现了它。实现它的浏览器并没有始终如一地这样做。
  • <plaintext> 已过时;接受它的浏览器可能会将其视为仍解释 HTML 的 <pre> 元素。
  • 如果 <plaintext> 是页面上的第一个元素(除了任何非显示元素,如 <head>),则根本不要使用 HTML。相反,使用 text/plain MIME 类型 提供文本文件。
  • 使用 <pre> 元素代替 <plaintext>,或者如果语义准确(例如对于内联文本),则使用 <code> 元素。转义任何 <>& 字符,以防止浏览器无意中将元素内容解析为 HTML。
  • 等宽字体可以通过具有 monospace 通用值的 CSS font-family 样式应用于任何 HTML 元素。

属性

¥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
# plaintext

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also