HTML and CSS Reference
In-Depth Information
The document can be made invalid in a number of ways. One is to use
elements that don't exist in the HTML specification. This invalid docu-
ment replaces all the regular tag names with shortened versions:
<ht>
<he>
<t>Minimal document</t>
</he>
<bo c="simple">
<p>A paragraph
<em>with emphasis</em></p>
</bo>
</ht>
The browser copes well with this; the main difference is that the title is
now visible, because the browser has no idea what a <t> element is.
In this document, the closing angle bracket has been left off the end of
each line:
<html
<head
<title>Minimal document</title
</head
<body class="simple"
<p>A paragraph
<em>with emphasis</em></p
</body
</html
Again the browser copes fairly well. The <title> element is lost because
now it's in position to be an attribute of the <head> element; but the con-
tent is all visible, and the one complete element, <em> , is displayed prop-
erly. This demonstrates that web browsers are resilient to badly
constructed HTML markup, but these two documents are broken in
significantly different ways. To highlight this, let's force the browser to
attempt to render these documents as XML , which is a much stricter
standard, instead of HTML . To do so, you can change the file extension
from .html to .xhtml. The two documents then create very different
results:
Search WWH ::




Custom Search