Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Stray start tag footer" in html validator?

I cannot work out why I am getting this error:

Stray start tag footer.

This is the code (I took the content out, this is just the tags)

<!doctype html>

<head>
    <title>title</title>
    <meta charset="UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
    <img src="heading.jpg" width="840" alt="pic">
    <!--<div id="container"></div> used ot set width of page -->
    <nav>
        <div id="columns">
            <a href="index.html">Home</a>
            <a href="products.html">Products</a>
            <a href="gift_ideas.html">Gift Ideas</a>
        </div>
        <br>
        <div id="link">
            <a href="link1.html">link1</a>|<a href="link2.html">link2</a>|<a href="link3.html">link 3</a>
        </div>
    </nav>
    <section>
        <br>
        <div id="homePage">
            <h1>Welcome</h1>
            <br>
            <div id="cart">
                <img src>
            </div>
        </div>
    </section>
</body>
<footer>
    <br>
    <h2>Contact Us</h2>
    Email: <a href="[email protected]">[email protected]</a>
    <img src>
</footer>

I am sure i have closed every tag, so what is the problem with the footer?

like image 259
Hayley van Waas Avatar asked Sep 22 '13 02:09

Hayley van Waas


People also ask

What does stray start tag in HTML mean?

A stray start tag <html> has been found in the document. As this tag defines the start of the whole HTML document, it should appear only once.

How do you fix start tag body seen but an element of the same type was already open?

Check the document structure to ensure there are no <meta> tags outside the head section. A common cause of this issue is having a duplicated, out of place <head>... </head> section. Ensure that this section appears in its proper place and is the only container for <meta> tags.

What is a stray end tag HTML?

As such, “Stray end tag...” means just that an end tag is not allowed in the context where it appears. As the validator's explanation says: “The Validator found an end tag for the above element, but that element is not currently open.


1 Answers

You need to move the </body> end tag at the very end, because a footer element must not appear after the body element but inside it. This follows from the syntax of the root element, the html element: it contains a head element and a body element, nothing more.

The validator says “Stray start tag footer” because the start tag appears in a context where no elements can be started – after the </body> tag, where only the optional </html> tag may appear.

like image 184
Jukka K. Korpela Avatar answered Sep 28 '22 19:09

Jukka K. Korpela