HTML and CSS Reference
In-Depth Information
Figure 4-14. The list as it appears in a browser with default styling
You can choose to omit the end tag of a list item if it's immediately followed by another list item, or if there
is no more content in the parent element (meaning it's the last item in the list, in which case the very next
tag will be the parent list's end tag). An li element can only occur as a child of the ul and ol elements, or
as a child of the interactive menu element, which is new in HTML5 and covered in Chapter 8.
Required Attributes
There are no required attributes for the li element.
Optional Attributes
value : If the li is a child of an ol element, this attribute can specify the item's displayed number
in the list, but doesn't change the actual list order. The attribute's value must be a whole integer,
and subsequent items will continue the numbering after a previous item's value. For example, in
an ordered list of five items where the third item has the attribute value="10" , the first two items
will be numbered 1 and 2 and the last three items numbered 10, 11, and 12 (assuming they have
no value attributes of their own).
dl
A description list isn't merely a collection of items; it's a collection of items and descriptions of each. Unlike
ordered and unordered lists, a description list doesn't contain list item ( li ) elements. Rather, items in a
description list are groupings of terms ( dt ) and descriptions ( dd ).
In past versions of HTML, the dl element was a definition list , intended to list terms and their definitions
like you'd find in a glossary. There's an implied semantic connection between a term and its definition, and
because of this semantic symbiosis, definition lists were frequently used to mark up content that wasn't
technically a list of terms and definitions. A series of questions and their answers, a list of employees and
 
Search WWH ::




Custom Search