dir (HTML element)
| Depr. | Empty | Version |
|---|---|---|
| Yes | No | HTML 2 |
| IE5.5+ | FF1+ | Saf1.3+ | Op9.2+ |
|---|---|---|---|
| Full | Full | Full | Full |
Example
The listing below shows a directory of plants:
<dir> <li>shrubs</li> <li>conifers</li> <li>hedges</li> </dir>
- Type
- block-level element
- Contains
lielements only- Contained by
applet,blockquote,body,button,center,dd,del,div,fieldset,form,iframe,ins,li,map,noframes,noscript,object,td,th
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.
Use This for…
The dir
element is used for series of directory titles.
Compatibility
| IE | 5.5 | Full |
|---|---|---|
| 6.0 | Full | |
| 7.0 | Full | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Full |
| 9.5 | 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.
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.

