HTML and CSS Reference
In-Depth Information
put it on a website, will the whole thing come crashing down around
your ears? Will you be arrested for crimes against markup?
Well, no.
The less trusting among you may have created a document with a para-
graph inside a heading and noted that the document loaded into the
browser just fine, so it may seem as though you can do what I've been
saying you can't. This is an aspect of a wider debate—is an HTML doc-
ument what some bloke says it is, or is it anything that works in the
browser? This is a complex issue, and I don't have room here to go into
every part of it. This section aims to equip you with a basic understand-
ing of the terms involved and highlight some of the consequences of not
following “the rules.”
Is this an HTML document?
There are different ways that markup can be invalid. In this section,
we'll look at several examples of invalid HTML, see what a browser
does with them, and then use the examples to introduce the concepts
and terminology involved. To start with, here's the valid document
from earlier:
<title>Minimal document</title>
<body class="simple">
<p>A paragraph
<em>with emphasis</em></p>
A valid document contains only elements listed in the HTML specifica-
tion, and those elements contain each other in ways described in the
specification; there's a single <html> element with two children, <head>
and <body> ; inline elements like <em> are contained within block ele-
ments like <p> ; and so on.
Search WWH ::

Custom Search