Dave's Brain

Browse - Programming Tips - Why do I get "Stray end tag 'head'" when I do view source in Firefox?

Date: 2016nov8
Product: Firefox
Language: html

Q.  Why do I get "Stray end tag 'head'" when I do view source in Firefox?

A.  I got this when I accidentally put an <h1> inside a <head>.
Since h1 is a body thing it implicitly closed the head and opened the body.  So the later explicit end head was called stray.  ie:

<head> ... <h1>My Heading<h1> WRONG </head> <body> ... </body>
<head> ... </head> <body> <h1>My Heading<h1> CORRECT ... </body>

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.