HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<listing> (Code Listing)

This deprecated element from HTML 2 is used to indicate a code listing; it is no longer part of the HTML standard. Text tends to be rendered in a smaller size within this element. Otherwise, the <pre> element should be used instead of <listing> to indicate preformatted text.

Standard Syntax (HTML 2 Only; Deprecated)


Attributes Defined by Internet Explorer

accesskey="key" (5.5)
class="class name(s)" (4)
contenteditable=" false | true | inherit" (5.5)
dir="ltr | rtl" (5.5)
disabled="false | true" (5.5)
hidefocus="true | false" (5.5)
id="unique alphanumeric string" (4)
lang="language code" (4)
language="javascript | jscript | vbs | vbscript" (4)
style="style information" (4)
tabindex="number" (5.5)
title="advisory text" (4)
unselectable="on | off" (5.5)

Events Defined by Internet Explorer

onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, onclick, oncontextmenu, oncontrolselect, oncopy, oncut, ondblclick, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onkeydown, onkeypress, onkeyup, onlosecapture, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror


This is a code listing. The preformatted text element &lt;pre&gt;
should be used instead of this depreciated element.


Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.7, 6, 7
Opera 6, 7


As a deprecated element, this element should not be used. This element is not supported by HTML 4. It is still documented by many browser vendors, however, and does creep into some pages. The <pre> element should be used instead of <listing>.

It appears that Netscape and Internet Explorer browsers also make text within <listing> one size smaller than normal text, probably because the HTML 2 specification suggested that 132 characters fit to a typical line rather than 80.

(X)HTML Elements
CSS Properties
Previous: link Next: map
< Home | About | Chapters | Examples | Errata | Reference | Site Map >