dir (HTML element)

Spec
Depr. Empty Version
Yes No HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

<dir compact="compact">
</dir>

Description

The dir element was originally intended to be used specifically to display directory lists, rather than to act as a generic list in which any content could be placed. Like the ol and ul list types, the dir element contains a series of li items.

Note that although the li is a block-level element, which would normally be able to contain other block-level elements, when it’s used in the context of a dir, a child li element can only contain inline elements.

Example

The listing below shows a directory of plants:

<dir>
<li>shrubs</li>
<li>conifers</li>
<li>hedges</li>
</dir>

Use This for…

The dir element is used for series of directory titles.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

When the dir element is used, most browsers will simply render the list exactly as they would a ul and series of li elements. As such, you’re better simply to use those elements instead, and thus ensure forwards and backwards compatibility, cross-browser support, and validity.

In this Section

User-contributed notes

There are no comments yet.

Related Products