Book HomeHTML & XHTML: The Definitive GuideSearch this book

7.7. Directory Lists

The directory list is a specialized form of the unordered list. It has been deprecated in the HTML 4 and XHTML standards. We don't recommend that you use it at all. Section 7.1.1, "The <ul> Tag"

7.7.1. The <dir> Tag (Deprecated)

The designers of HTML originally dedicated the <dir> tag for displaying lists of files. As such, the browser, if it treats <dir> and <ul> differently at all (most don't), expects the various list elements to be quite short, possibly no longer than 20 characters or so. Some browsers display the elements in a multicolumn format and may not use a leading bullet.

As with the unordered list, define directory list items with the <li> tag. When used within a directory list, however, the <li> tag may not contain any block element, including paragraphs, other lists, preformatted text, or forms.

The following example puts the directory tag to its traditional task of presenting a list of filenames:

The distribution tape has the following files on it:
<dir>
  <li><code>README</code></li>
  <li><code>Makefile</code></li>
  <li><code>main.c</code></li>
  <li><code>config.h</code></li>
  <li><code>util.c</code></li>
</dir>

<dir>

Function:

Define a directory list

Attributes:

CLASS

ONKEYUP

DIR

ONMOUSEDOWN

ID

ONMOUSEMOVE

LANG

ONMOUSEOUT

ONCLICK

ONMOUSEOVER

ONDBLCLICK

ONMOUSEUP

ONKEYDOWN

STYLE

ONKEYPRESS

TITLE

End tag:

</dir>; never omitted

Contains:

list_content

Used in:

block

Notice that we use the <code> tag to ensure that the filenames would be rendered in an appropriate manner (see Figure 7-9 as rendered by the now ancient Mosaic browser).

Figure 7-9

Figure 7-9. An example <dir> list

7.7.1.1. The <dir> attributes

The attributes for the <dir> tag are identical to those for <ul> with the same effects.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.