Skip to: content, navigation

by Ian Lloyd

plaintext (HTML element)

Spec
Depr. Empty Version
Yes Yes N/A
Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Partial Partial Partial Partial

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:

Example of s element

Use this for…

Anything goes.

Compatibility

IE5.5Partial
6.0Partial
7.0Partial
Firefox1.0Partial
1.5Partial
2.0Partial
Safari1.3Partial
2.0Partial
3.0Partial
Opera9.2Partial
9.5Partial

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.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters