Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 733
Casebash Avatar asked Jul 09 '26 19:07

Casebash


1 Answers

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>
like image 135
Matthew Flaschen Avatar answered Jul 14 '26 11:07

Matthew Flaschen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!