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
surrounding 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
Although universal in meaning, there are some differences and
restrictions to the use of the
<li> tag for
each list type. In unordered and ordered lists, what follows the
<li> tag may be nearly anything, 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
Directory and menu lists are another matter. They are lists of short items, like a single ...