Contents
<!ENTITY % ULStyle "disc|square|circle"> <!ELEMENT UL - - (LI)+> <!ATTLIST UL -- unordered lists -- %attrs; -- %coreattrs, %i18n, %events -- type (%ULStyle) #IMPLIED -- bullet style -- compact (compact) #IMPLIED -- reduced interitem spacing -- > <!ENTITY % OLStyle "CDATA" -- constrained to: [1|a|A|i|I] --> <!ELEMENT OL - - (LI)+> <!ATTLIST OL -- ordered lists -- %attrs; -- %coreattrs, %i18n, %events -- type %OLStyle #IMPLIED -- numbering style -- compact (compact) #IMPLIED -- reduced interitem spacing -- start NUMBER #IMPLIED -- starting sequence number -- >
Start tag: required, End tag: required
<!-- The type attribute can be used to change the bullet style in unordered lists and the numbering style in ordered lists --> <!ENTITY % LIStyle "CDATA" -- constrained to: "(%ULStyle|%OLStyle)" --> <!ELEMENT LI - O %block -- list item --> <!ATTLIST LI %attrs; -- %coreattrs, %i18n, %events -- type %LIStyle #IMPLIED -- list item style -- value NUMBER #IMPLIED -- reset sequence number -- >
Start tag: required, End tag: optional
Attribute definitions
Attributes defined elsewhere
Ordered and unordered lists are identical except that visual user agents number ordered list items. User agents may present those numbers in a variety of ways. Unordered list items are not numbered.
Both types of lists are made up of sequences of list items defined by the LI element (whose end tag is generally omitted).
This example illustrates the basic structure of a list.
<UL> <LI> ... first list item... <LI> ... second list item... ... </UL>
Lists may also be nested:
<UL> <LI> ... Level one, number one... <OL> <LI> ... Level two, number one... <LI> ... Level two, number two... <OL start="10"> <LI> ... Level three, number one... </OL> <LI> ... Level two, number three... </OL> <LI> ... Level one, number two... </UL>
Details about number order. In ordered lists, it is not possible to continue list numbering automatically from a previous list or to hide numbering of some list items. However, you can reset the number of a list item by setting its value attribute. Numbering continues from the new value for subsequent list items. For example:
<ol> <li value="30"> makes this list item number 30. <li value="40"> makes this list item number 40. <li> makes this list item number 41. </ol>
Visual browsers usually present nested lists indented with respect to the current level of indentation.
For both OL and UL, the type attribute specifies rendering options for visual user agents.
For the UL element, possible values for the type attribute are disc, square, and circle. The default value depends on the level of nesting of the current list.
How each value is presented depends on the user agent. User agents should attempt to present a "disc" as a small filled-in circle, a "circle" as a small circle outline, and a "square" as a small square outline.
Your user agent displays them as follows (the bullet glyph in the line may or may not vary):
For the OL element, possible values for the type attribute are summarized in the table below:
Type | Numbering style | |
---|---|---|
1 | arabic numbers | 1, 2, 3, ... |
a | lower alpha | a, b, c, ... |
A | upper alpha | A, B, C, ... |
i | lower roman | i, ii, iii, ... |
I | upper roman | I, II, III, ... |
<!-- definition lists - DT for term, DD for its definition --> <!ELEMENT DL - - (DT|DD)+> <!ATTLIST DL %attrs; -- %coreattrs, %i18n, %events -- compact (compact) #IMPLIED -- reduced interitem spacing -- >
Start tag: required, End tag: required
<!ELEMENT DT - O (%inline)*> <!ELEMENT DD - O %block> <!ATTLIST (DT|DD) %attrs -- %coreattrs, %i18n, %events -- >
Start tag: required, End tag: optional
Attributes defined elsewhere
Definition lists vary only slightly from other types of lists in that list items consist of two parts: an initial label and a description. The label part is initiated by the DT element and may only contain marked up text. The description begins with the DD element and may contain block-level content.
Here is a sample definition list.
<DL> <DT> <em>Daniel</em> <DD> Born in France, Daniel's favorite food is foie gras. <P> In this paragraph, we'll discuss Daniel's harem: Pascale, Audrey, Laurie, and Alice. <DT> <em>Tim</em> <DD> Born in New York, Tim's favorite food is ice cream. </DL>The rendering of a definition list depends on the user agent. Your user agent renders this example as follows:
In this paragraph, we'll discuss Daniel's harem: Pascale, Audrey, Laurie, and Alice.
DIR and MENU are deprecated
<!ELEMENT (DIR|MENU) - - (LI)+ -(%blocklevel)> <!ATTLIST DIR %attrs; -- %coreattrs, %i18n, %events -- compact (compact) #IMPLIED > <!ATTLIST MENU %attrs; -- %coreattrs, %i18n, %events -- compact (compact) #IMPLIED >
Start tag: required, End tag: required
Attributes defined elsewhere
The DIR element was designed to be used for creating multicolumn directory lists. The MENU element was designed to be used for single column menu lists. Both elements have the same structure as UL, just different rendering. In practice, a user agent will render a DIR or MENU list exactly as a UL list.
We strongly recommend using UL instead of these elements.