Skip to main content
HTML Validation

Stray start tag “footer”.

About This HTML Issue

A <footer> placed after the closing </body> or </html> tag is stray, because the HTML parser allows no elements there.

Everything visible on a page goes inside <body>, the site footer included. Once the parser reads </body>, only whitespace, comments and the closing </html> tag may follow. Any element after that point is a parse error. Browsers recover by moving the footer back into the body as its last child, so the page usually looks right and the mistake goes unnoticed.

Templates are the usual source. A layout file closes the body before it includes the footer partial, or the page ends up with two </body> tags. The parser takes the first </body> as the end of the body, so a footer after it is stray even when another </body> follows. The validator doesn't flag that second </body>, so search the page for every </body> and keep only the last one.

Move the <footer> inside <body>, before its closing tag. It can sit directly in <body> as the page footer, or inside an <article> or <section> as the footer for that part of the page.

Invalid example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Contact us</title>
</head>
<body>
  <main>
    <h1>Contact us</h1>
    <p>Send us a message and we will reply within two days.</p>
  </main>
</body>
<footer>
  <p>Example Company, 123 Main Street</p>
</footer>
</html>

Valid example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Contact us</title>
</head>
<body>
  <main>
    <h1>Contact us</h1>
    <p>Send us a message and we will reply within two days.</p>
  </main>
  <footer>
    <p>Example Company, 123 Main Street</p>
  </footer>
</body>
</html>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries