HTML and CSS Reference
In-Depth Information
Invalid document 1
Invalid document 2
The first document, even though it has only one valid HTML element,
is structured in a valid way, so the browser still parses it into a tree
structure. Although this document isn't valid HTML , it's well formed : the
elements, tags, and attributes follow the basic rules of markup. The
second document doesn't follow these basic rules, so as well as being
invalid, it's also not well formed.
There are more subtle ways to make the markup invalid. Consider the
following markup fragment:
<p><strong>A slightly <em>odd</strong> looking sentence</em></p>
This is invalid because the <em> and <strong> elements aren't nested cor-
rectly. The <em> element starts before the <strong> element end tag, but
the <em> element end tag is outside the <strong> element. Either the two
elements should be entirely separate, or one should be contained within
the other. In keeping with the resiliency demonstrated previously, most
browsers manage to render this fragment similarly.
Firefox
Chrome
Opera
IE
Search WWH ::




Custom Search