plaintext (HTML element)
Example
plaintext being
used to demonstrate a code sample:
<p>The markup for this is:</p>
<plaintext><h1>Main heading goes here</h1>
<p>First paragraph goes here</p>
<h2>Sub-heading goes here</h2></plaintext>.
</body>These two lines are left here for a purpose! See compatibility section
</html>
- Type
- inline element
- Contains
- text
- Contained by
- N/A
Description
The plaintext
element was originally intended to instruct the browser to ignore any
formatting or HTML markup , such that <p> would
appear in screen as <p> rather than actually create
a new paragraph. It is deprecated and is probably best forgotten entirely.
The example shown would render as follows:

Use this for…
Anything goes.
Compatibility
| IE | 5.5 | Partial |
|---|---|---|
| 6.0 | Partial | |
| 7.0 | Partial | |
| Firefox | 1.0 | Partial |
| 1.5 | Partial | |
| 2.0 | Partial | |
| Safari | 1.3 | Partial |
| 2.0 | Partial | |
| 3.0 | Partial | |
| Opera | 9.2 | Partial |
| 9.5 | Partial |
The
plaintext element has an optional closing tag, but in
the browsers tested, the closing </plaintext> tag was
ignored completely - effectively every HTML tag after the opening
<plaintext> was ignored and therefore not parsed by the
browser. By placing this non-standard element on a page, you kill off
anything that follows. Note in the screenshot, even the closing
</body> and </html> tags, which came after the
closing </plaintext> tag, are rendered on screen. You should
use the pre element
instead for the purposes of rendering carriage returns and white space,
and convert any HTML delimiters (the < and
> parts of the opening and closing tags) to HTML
entities.
Related Reading
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

