XMP, Listing, and Plaintext Still Work
May 11, 2012
Posted by on
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.
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
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.