Skip to main content

HTML Guide

Stray start tag “div”.

A <div> tag appears where the HTML structure does not expect it, often due to incorrect nesting or missing closing tags.

HTML elements must be properly nested and closed according to the specifications outlined by the HTML standard. A stray start tag usually occurs when a block-level element like <div> is used in a context where only phrasing (inline) content is permitted, or if required closing tags (such as </li>, </tr>, or </td>) are missing, causing the parser to be out of sync.

Incorrect Example: div after closing the html tag

<!DOCTYPE html>
<html lang="">
<head>
<title>Test</title>
</head>
<body>
<p></p>
</body>
</html>
<div>
  some extra content
</div>

In the above, the <div> at the bottom is not valid because it appears after closing the html tag.

Always close elements properly and place block-level elements like <div> only inside appropriate containers. If your issue occurs elsewhere, look for missing closing tags or incorrect placement of the <div> relative to tables, lists, or other structural elements.

Learn more:

Related W3C validator issues