In a well-formed document
- All elements are well-formed
- A single element, known as the
root
element,
contains all of the other elements in the document
A well-formed element is one that is either
- Opened and subsequently closed
- An empty element
The following are
not well-formed
<i><b>word</i>
<i><b>word</i></b>
But, according to
CSS Tricks,
HTML need not be well-formed.
In particular
- Documents may not be well-formed
- Element and attribute names may not be in lower case.
- For non-empty elements, end tags are not always required.
- Attribute values may not always be quoted.
- Entity references as hex values may not only be in lowercase