I'm trying to validate my document for HTML5 using the W3C validator at http://validator.w3.org/check. When I run the code below using "direct input" I get error messages like Element head is missing a required instance of child element title and Stray start tag html. This baffles me, because the <html>
tag is right there. Why can't the validator see it?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="some content">
<title>page title</title>
</head>
<body>
</body>
</html>
Update: I'm using PHP to generate parts of the file and it turns out this was the cause of the error.
I discovered the error. I'm using PHP to generate the page. When I viewed it in a hex editor I discovered two null bytes (hex code 0x00) before the tag. Exactly where my first
<?php ?>
tag were. When I copied the code or ran it by URL, the validator encountered the null bytes. When I wrote the code manually, it validated fine.I moved the first PHP tag down to the first line of the body and the validation passed.
it is not giving error, instead of two warnings, i have checked in the same link.