List Formatting

List Formatting Tags

<DIR> dir: a list of short items, typically up to 20 characters each. Most browsers implement this element exactly the same as an unordered list while a few others arrange the data in columns across the screen. The only content of this list structure is the <LI> (list item) element. As with other list elements, the closing </LI> tag is optional, as it is implied by the subsequent <LI> or end </DIR> tags. Example:
Example HTML code Display Result
<dir>
<li>Item one in the list.
<li>Item two in the list.
<li>Item three in the list.
</dir>
  • Item one in the list.
  • Item two in the list.
  • Item three in the list.
  • <DL> definition list: a list of terms and corresponding definitions. Typical formatting of a definition list is flush left for the term (<DT>) with the definition (<DD>) indented on a separate line (block formatted.) An alternate method of display is to have the <DD> item indented on the same line as the <DT> to more strongly associate the term/definition relationship. The contents of this list structure is a sequence of <DT> and <DD> terms (this is the only list structure in which the <DT> and <DD> elements are allowed to appear, and they are usually found in pairs.) Multiple <DT> terms may be paired with a single <DD> term, but should not be paired with multiple consecutive <DD> elements. As with other list content tags, the closing </DT> and </DD> tags are optional, as they are implied by the subsequent list items or end </DL> tags. Example:
    Example HTML code Display Result
    <dl>
    <dt>Term1<dd>First definition description.
    <dt>Term2<dd>Second definition description.
    <dt>Term3<dd>Third definition description.
    </dl>

    Term1
    First definition description.
    Term2
    Second definition description.
    Term3
    Third definition description.

    <MENU> menu: a list of items typically having one line per item. Though the common implementation of this element is usually the same as an unordered list, the MENU style should be more compact. The only content of this list structure is the <LI> (list item) element. As with other list structures, the closing </LI> tag is optional, as it is implied by the subsequent <LI> or end </MENU> tags. Example:
    Example HTML code Display Result
    <menu>
    <li>Item one in the list.
    <li>Item two in the list.
    <li>Item three in the list.
    </menu>
  • Item one in the list.
  • Item two in the list.
  • Item three in the list.
  • <OL> ordered list: a list of items sorted by sequence or order of importance. Typical rendering is a numbered list of items. The only content of this list structure is the <LI> (list item) element. As with other list types, the closing </LI> tag is optional, as it is implied by the subsequent <LI> or end </OL> tags. Example:
    Example HTML code Display Result
    <ol>
    <li>Item one in the list.
    <li>Item two in the list.
    <li>Item three in the list.
    </ol>
    1. Item one in the list.
    2. Item two in the list.
    3. Item three in the list.
    For more examples of the different ways an ordered list can be displayed, click here
    <UL> unordered list: The Unordered List element represents a list of items in which order is not necessarily important. Typical rendering is a bulleted list of items. Many browsers may change the appearance of the bullet when the list is nested in another list. The only content of this list structure is the <LI> (list item) element. As with other list content elements, the closing </LI> tag is optional, as it is implied by a subsequent <LI> or end </UL> tags. Example:
    Example HTML code Display Result
    <ul>
    <li>Item one in the list.
    <li>Item two in the list.
    <li>Item three in the list.
    </ul>
    • Item one in the list.
    • Item two in the list.
    • Item three in the list.
    For more examples of the different ways an unordered list can be displayed, click here

    List Item Tags

    <DD> definition list description: the description of a definition list term. Multiple <DT>s may be grouped with a single <DD>, but should not contain multiple consecutive <DD> elements. As with other list elements, the closing </DD> tag is optional, as they are implied by the subsequent list items or end </DL> tags.
    <DT> definition list term: a term in the definition list. Multiple <DT>s may be grouped with a single <DD>, but should not contain multiple consecutive <DD> elements. As with other list elements, the closing </DD> tag is optional, as they are implied by the subsequent list items or end </DL> tags.
    <LI> list item: used as a sub-element of a list type. <DIR>, <MENU>, <OL>, and <UL> all use it to mark a component of their structure. The <LI> element is the only content of these list structures. The closing </LI> tag is optional, as it is implied by the subsequent <LI> or end list tags.