The ISA-Bus

One blog to bind them all.

XMP, Listing, and Plaintext Still Work

XMP, LISTING, and PLAINTEXT were three early HTML tags with essentially the same function: To show text as-is, with all the line breaks and white space, and without parsing it for markup. That is the big difference to PRE, where markup is parsed. These three tags are therefore ideal for showing HTML code without having to escape any characters.

XMP and LISTING both recognize their own end tags. XMP assumes 80 columns, LISTING 132 columns, a common standard in text terminals supported by many PC graphic cards as well. PLAINTEXT does not even recognize its own end tag. After this tag, nothing will be parsed any more, which can save loading times.

These three tags have been considered obsolete or deprecated since at least 1993, and I was under the assumption that they were not supported in modern browsers, but treated like PRE. I was wrong. Firefox 12, Google Chrome 18, and Internet Explorer 8 all support these tags exactly as intended. Firefox and IE even differ between XMP and LISTING: If the base font is large enough, they will render LISTING smaller than XMP. This is completely independent of the !DOCTYPE declaration, or of any other tags used in the document.

So, basically there’s no reason not to use these tags, except that the code won’t validate, something I come to see as less and less relevant.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: