HTML validation · Document structure

Head is not first in the html element

The meta charset tag appears before the head element starts, so the head is not the first thing inside the html element.

How this page is built

In the source of this page, the <meta charset> tag comes after the opening html tag but before the opening head tag.

Browsers create the head as soon as they meet the meta tag and then ignore the real head start tag, so the page still works.

Why it matters

The head should be the first element inside html. When something comes before it, browsers create a head automatically and treat the real head tag as an error.

Simple cases like this one are harmless in browsers, but they are a sign that the template is out of order. If the element before the head is one that belongs in the body, the whole head can end up in the body instead.

How to check it

View the source and look at what follows the opening html tag. The W3C Nu HTML Checker reports a stray head start tag. Crawl tools that validate HTML will also flag it.

How to fix it

Move everything that belongs in the head inside the head element, and make sure nothing else is printed between the html and head tags.

Check includes and plugins that add markup at the very top of the page.

Back to all tests