Casebash
Casebash

Reputation: 118792

W3C Validator - Document type does not allow element "body" here

I am trying to validate the following code with the W3C validator:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <title>Test</title>
</head>
<body>
</body>
</html>

I get two errors:

Document type does not allow element "body" here

End tag for "html" which is not finished

Does anyone know how to fix this?

Upvotes: 3

Views: 5888

Answers (1)

Matthew Flaschen
Matthew Flaschen

Reputation: 284796

You're using the Frameset DTD, which doesn't allow body. It is meant for use with framesets, which are used to display frames. You can use Strict instead:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <title>Test</title>
</head>
<body>
</body>
</html>

Upvotes: 8

Related Questions