This code generates a couple errors on the w3.org validator, and I just can’t see what’s wrong. Maybe someone who hasn’t been staring at it for the last hour can see the obvious for me?
[code=html]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN” “http://www.w3.org/TR/html4/frameset.dtd”>
<html lang=’en’>
<head>
<META HTTP-EQUIV=’Content-Type’ CONTENT=’text/html; charset=ISO-8859-1′>
<title>Page title</title>
<style type=”text/css”>
<!–
body {
margin: 0;
padding: 0px;
background-color: #919fa8;
font: 90% verdana, helvetica, sans-serif;
}
.container {
margin: 10px auto;
width: 750px;
background-color: white;
padding: 10px;
color: #123;
}
h1 {
font-size: x-large;
letter-spacing: 0.08em;
color: #369;
margin: 5px 0 0 0;
padding: 0;
}
h2 {
font-size: medium;
color: #369;
margin: 0 0 10px 0;
padding: 0 0 10px 0;
border-bottom: solid 2px #919fa8;
}
h3, h4 {
color: #369;
margin: 1.5em 0 0 0;
}
a {color: #369;}
a:visited {color: #666;}
a:hover {color: #c33;}
iframe {
width: 724px;
height: 600px;
}
#valid {text-align: center;}
–>
</style>
</head>
<body>
<p>test</p>
</body>
</html>
The error messages:
[quote]# Error Line 50 column 5: document type does not allow element “BODY” here.
<body>
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements — such as a “style” element in the “body” section instead of inside “head” — or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML’s rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML’s “self-closing” tags for “meta” and “link” in the “head” section of a HTML document may cause the parser to infer the end of the “head” section and the beginning of the “body” section (where “link” and “meta” are not allowed; hence the reported error).
✉
</html>
Most likely, You nested tags and closed them in the wrong order. For example <p><em>…</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>…</em></p>
Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is “not finished”, not complete. For instance, <head> generally requires a <title>, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.