HTML validation · Head element
Invalid elements in the head
An image element, used as a tracking pixel, sits in the head. Parsers close the head early when they reach it.
How this page is built
A one-pixel image sits at the end of the head of this page, where a tracking pixel is often placed. Images are not allowed in the head, so browsers close the head as soon as they reach it.
Only the analytics script comes after the image in the source, so no important tags are pushed into the body here.
Why it matters
Only certain elements are allowed in the head, such as title, meta, link, script and style. When a parser meets anything else, it closes the head and starts the body.
Every tag after that point, which can include the canonical, meta robots or hreflang, is then in the body, where search engines may ignore it.
How to check it
View the source and look for elements in the head that belong in the body, such as img, div, iframe or p. The W3C Nu HTML Checker reports them. Compare the source with the parsed head in browser developer tools.
How to fix it
Move tracking pixels and other body elements into the body. If a third-party tag requires an image, place it straight after the opening body tag, and keep important SEO tags near the top of the head.