home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


In addition to the standard attributes, DL can take the optional attribute COMPACT, to signify that the list should be rendered in a physically compact way—this attribute takes no value. This is useful for compacting a list of small items or to compact a large list that would be easier to read if rendered in a compact manner. This tends to close up text, for example by placing the DT and DD text content on the same line. COMPACT is understood by Netscape Navigator 3/4 and Internet Explorer 4.

Figures 6.25 and 6.26 show an example of a DL list, and illustrate the effect of COMPACT on list rendering.


Figure 6.25 HTML example document illustrating the DL glossary list elements, and a UL unordered list nested inside a glossary list. Figure 6.26 shows this document as displayed by Internet Explorer 4.

<HTML> <HEAD><TITLE> Example of Glossary List elements </TITLE>
</HEAD><BODY BGCOLOR=“white”>
<H2> Example Glossary Lists </H2>

<P>The third <B>DD</B> has an unordered (<B>UL</B>) list inside it.
Note that the first term (<B>DT</B>) does not have a matching
description (<B>DD</B>). This is perfectly legal.  
You can use <B>BR</B> elements to add extra vertical spacing --
here it is done after the first <B>DT</B>.</P>
<HR NOSHADE>
<DL>
  <DT>Things to do: <BR><BR>
  <DT>Things to Avoid:
  <DD>Writing examples for HTML books that make you look like an
      idiot!  In particular, spelling your wife’s name incorrectly
      is not a good idea.
  <DT>Things to worry about:
  <DD>People you should never let format lists include:
      <UL>
	 <LI>Bozo the Clown
	 <LI>Uncle Fester
	 <LI>Knights that go nii
      </UL>
      as they generally do a poor job.
</DL>
<HR NOSHADE>
<TABLE CELLPADDING=“3” CELLSPACING=“6”WIDTH=“100%”>

<TR><TD BGCOLOR=“#dddddd” VALIGN=“top” WIDTH=“50%”>
<H3>A Simple DL List</H3>
<DL>
   <DT>Etc.     <DD>Et Cetera
   <DT>HTTP     <DD>HyperText Transfer Protocol
   <DT>HTML     <DD>HyperText Markup Language
</DL>

</TD><TD  BGCOLOR=“#dddddd” VALIGN=“top” WIDTH=“50%”>

<H3>Same List -- With <B>COMPACT</B></H3>
<DL COMPACT>
   <DT>Etc.     <DD>Et Cetera
   <DT>HTTP     <DD>HyperText Transfer Protocol
   <DT>HTML     <DD>HyperText Markup Language
</DL>

</TD></TR></TABLE></BODY></HTML>


Figure 6.26  Display, by Internet Explorer 4, of the document shown in Figure 6.25.

DT Element: Term in a Glossary List

Usage: <DT> ... (</DT>)
Can Contain: characters, character highlighting, A, APPLET, BASEFONT, BR, BUTTON, IFRAME, IMG, INPUT, LABEL, MAP, OBJECT, SCRIPT, SELECT, TEXTAREA
Can Be Inside: DL
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers

The DT element contains the term part of a glossary or description list entry. The contents of a DT element should be short—typically, a few words, and certainly shorter than a line. The element can contain standard character markup, images, line breaks, and hypertext anchors, as well as form input elements.

The DT element is not empty, but the terminating </DT> is optional, as it is implied by the start of another <DT> or <DD> element or by the </DL> ending the list.

DD Element: Description in a Glossary List

Usage: <DD> ... (</DD>)
Can Contain: ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, DL, FIELDSET, FORM, Hn, HR, [ISINDEX], MENU, NOFRAMES, NOSCRIPT, OL, P, PRE, TABLE, UL,
characters, character highlighting, A, APPLET, BASEFONT, BR, BUTTON, IFRAME, IMG, INPUT, LABEL, MAP, OBJECT, SCRIPT, SELECT, TEXTAREA
Can Be Inside: DL
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers

The DD element gives the description corresponding to the previous DT element or elements. It can be a long description, broken into paragraphs and containing other lists, FORM s, quotations, and so on. A DD element should follow a DT element and should not occur alone.

Most browsers render DD content a line below and slightly indented relative to the DT content. This may be changed if the DL element took the COMPACT attribute—in this case, the DD content may be tab-indented relative to the DT content, and on the same line.

DD is not empty, but the terminating </DD> is optional, since the end is implied either by the <DT> or <DD> tag starting another element or by the </DL> tag terminating the list.

OL Element: Ordered List

Usage: <OL> ... </OL>
Can Contain: LI
Can Be Inside: BLOCKQUOTE, BODY, CENTER, DD, DIV, FIELDSET, FORM, LI, NOFRAMES, NOSCRIPT, TD, TH,
APPLET, BUTTON, IFRAME, OBJECT
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers,
COMPACT, START, TYPE

OL defines an ordered list. Each item in the list is contained within an LI (list item) element—LI elements are the only elements that can appear inside OL. Items can be paragraphs of text, but should be kept reasonably short, as otherwise, the idea of a list is lost. If the list items are big, perhaps it is not really a list: Try paragraphs with appropriate section headings. A typical ordered list is shown in Figures 6.27 and 6.28.

A browser indicates item ordering by numbering the items, by assigning them ascending letters, et cetera. OL can take three attributes: COMPACT to render the list in compact format, and TYPE and START to control how items are numbered and ordered.

COMPACT (optional) Indicates that the list should be rendered in a compact format, for example by reducing the space between items or by arranging the items horizontally across the display. This attribute is not widely supported.
START=“number” (optional) Specifies the starting number for the first item in the list, where number is an integer specifying the starting number.
TYPE=“A,” “a,” “I,” “i,” “1” (optional) Specifies the type of the marker by which the items should be numbered. Thus, TYPE=“A” and TYPE=“a” imply ordering via capital or lowercase letters respectively, while TYPE=“I” and TYPE=“i” imply ordering with uppercase or lowercase roman numerals respectively. TYPE=“1” invokes standard numerical ordering and is the default.

UL Element: Unordered List

Usage: <UL> ... </UL>
Can Contain: LI
Can Be Inside: BLOCKQUOTE, BODY, CENTER, DD, DIV, FIELDSET, FORM, LI, NOFRAMES, NOSCRIPT, TD, TH,
APPLET, BUTTON, IFRAME, OBJECT
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers,
COMPACT, TYPE


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.