Required elements and optional tags in HTML

In HTML, some elements have optional tags. In fact, both the opening and closing tags of some elements may be completely removed from an HTML document, even though the elements themselves are required. Does that seem a bit confusing?

It can seem strange, especially considering that three required HTML elements whose start and end tags are optional are the html, head, and body elements. Yes, you can leave those out of your markup in HTML (but not in XHTML). The browser will still create the elements, and they will be available in the document tree.

Still confused? Read Gez Lemon's detailed explanation in Required Elements, and Required Tags.

Posted on December 22, 2005 in Quicklinks, (X)HTML