logo logo

bullet listing in HTML pages

The <dir> Tag

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><code>Makefile</code>
  <li><code>main.c</code>
  <li><code>config.h</code>
  <li><code>util.c</code>
</dir>

Notice that we use the <code> tag to ensure that the filenames would be rendered in an appropriate manner (see Figure 8.8).

Like the other formatting tags we’ve seen so far, the <dir> tag has an optional compact attribute for producing an even more reduced list display, even though virtually none of the browsers is either willing or capable of compacting directory lists.

You can change the style used to bullet the <dir> list items with the type attribute extension and the values circle, square, or disc. This behavior is identical to the type attribute in an unordered list.

bottom

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

bottom