Back to Content

: The Plain Text element (Deprecated)

files/en-us/web/html/reference/elements/plaintext/index.md

latest1.8 KB
Original Source

{{deprecated_header}}

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.

  • <plaintext> is deprecated since HTML 2, and not all browsers implemented it. Browsers that did implement it didn't do so consistently.
  • <plaintext> is obsolete; browsers that accept it may instead treat it as a {{HTMLElement("pre")}} element that still interprets HTML within.
  • If <plaintext> is the first element on the page (other than any non-displayed elements, like {{HTMLElement("head")}}), do not use HTML at all. Instead serve a text file with the text/plain MIME-type.
  • Instead of <plaintext>, use the {{HTMLElement("pre")}} element or, if semantically accurate (such as for inline text), the {{HTMLElement("code")}} element. Escape any <, > and & characters, to prevent browsers inadvertently parsing the element content as HTML.
  • A monospaced font can be applied to any HTML element via a CSS {{cssxref("font-family")}} style with the monospace generic value.

Attributes

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

DOM interface

This element implements the {{domxref('HTMLElement')}} interface.

<!-- ## Technical summary -->

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • The {{HTMLElement("pre")}} and {{HTMLElement("code")}} elements, which should be used instead.
  • The {{HTMLElement("xmp")}} element, also obsolete, similar to <plaintext>.