How to fix: End tag for body seen, but there were unclosed elements.

Most Likely Cause and Fix

Your markup contains an unclosed element at the point your document ended.

Prior to your closing </body> and </html> tags, ensure all previously-opened elements are correctly closed.

Use:

<html>
  <head></head>
  <body>
    <div>
      …
    </div>
  </body>
</html>

instead of:

<html>
  <head></head>
  <body>
    <div>
      …
    <!-- opened 'div' is never closed -->
  </body>
</html>

What This Error Means

The validator reached your closing </body> or </html> tag and found that a previously-opened element had not been closed.

How To Fix It

Prior to your closing </body> and </html> tags, ensure all previously-opened elements are correctly closed.

Use:

<html>
  <head></head>
  <body>
    <div>
      …
    </div>
  </body>
</html>

instead of:

<html>
  <head></head>
  <body>
    <div>
      …
    <!-- opened 'div' is never closed -->
  </body>
</html>

Discuss, Comment and Improve

Did this help you? Can this page be improved? Let us know!

comments powered by Disqus