Unclosed HTML Tag
An unclosed tag occurs when an opening HTML tag like <div>, <p>, or <span> is missing its corresponding closing tag. Browsers try to auto-close tags, but the results are unpredictable — content can be swallowed, layouts break, and styles bleed into wrong sections.
Why It Matters
Unclosed tags are one of the most common causes of broken layouts. A single unclosed <div> can shift your entire page structure. Screen readers also depend on proper tag closure to navigate content correctly.
Code Examples
<div class="card"> <h2>Title</h2> <p>Description </div>
<div class="card"> <h2>Title</h2> <p>Description</p> </div>
How to Fix
- 1Use an HTML validator to find the exact line where the unclosed tag starts.
- 2Work from the innermost unclosed tag outward — fix nested issues first.
- 3Use an editor with bracket matching (VS Code highlights matching tags).
- 4Self-closing tags like <img>, <br>, <input>, and <hr> do not need a closing tag.
Check Your HTML Now
Our validator detects this error automatically and shows the exact line number.
Open HTML ValidatorHostinger — Fast & Affordable Web Hosting
Deploy clean, validated HTML on reliable hosting.
Related HTML Errors
Incorrect Tag Nesting
Learn the HTML nesting rules: which elements can contain which. Fix p inside p, div inside span, and other nesting errors.
Duplicate ID Attributes
Why duplicate IDs break JavaScript and accessibility. Learn how to find and fix duplicate id attributes in your HTML.
Missing DOCTYPE Declaration
Learn why <!DOCTYPE html> is required and what happens when it's missing. Fix quirks mode rendering issues.