HTML 4 Bible, 2nd Edition 8
HTML 4 Bible, 2nd Edition 8
When the browser sees a start tag, it knows the text to come will all be of the type
defined by the start tag. Not until the browser sees an end tag does it stop expect-
ing the text to be of that type. Because elements can often be nested — not all
elements can be nested within all other elements, but there are valid element nest-
ings — it doesn’t automatically assume a different start tag indicates the previous
element type has ended. In fact, the browser assumes nothing. Forget about the
benefit of the doubt. The browser takes everything you send it absolutely literally.
Note To add another layer of confusion, some elements will display correctly without
their end tag, as long as the end of an element can be clearly determined from
other surrounding elements. For example, the LI (list item) and P (paragraph) tag
don’t require end tags, since their end can be clearly determined by the beginning
of the next element. Still, you won’t go wrong by always including end tags.
Definition Nesting. Placing elements within other elements. For example, in a table, the
rows are nested within the table element, and the cells are nested within the row
elements.