HTML and CSS Reference
In-Depth Information
7.3. The <li> Tag
It should be quite obvious to you by now that the <li> tag defines an
item in a list. It's the universal tag for list items in ordered ( <ol> ) and
unordered ( <ul> ) lists, as we discussed earlier, and for directories ( <dir> )
and menus ( <menu> ), which we discuss in detail later in this chapter.
Because the end of a list element can always be inferred by the sur-
rounding document structure, most authors omit the ending </li> tags
for their HTML list elements. That makes sense because it becomes easier
to add, delete, and move elements around within a list. However, XHTML
requires the end tag, so it's best to get used to including it in your docu-
Although universal in meaning, there are some differences and restric-
tions to the use of the <li> tag for each list type. In unordered and
ordered lists, nearly anything can follow the <li> tag, including other lists
and multiple paragraphs. Typically, if it handles indentation at all, the
browser successively indents nested list items, and the content in those
items is justified to the innermost indented margin.
Search WWH ::

Custom Search