About This HTML Issue
HTML elements follow strict nesting rules defined by the WHATWG HTML Living Standard. Every element has a content model — a description of what content (text, elements, or both) it may contain. When you place an element somewhere it isn’t allowed, the browser must guess your intent and may restructure the DOM in unexpected ways. This can lead to inconsistent rendering across browsers, broken layouts, and accessibility issues for screen readers and other assistive technologies.
The “(Suppressing further errors from this subtree.)” part of the message means the validator has stopped checking anything nested inside the problematic element. This is important — it means there could be additional errors hidden beneath this one. Fixing this nesting issue may reveal further problems that need attention.
Here are some of the most common cases that trigger this error:
-
Block elements inside inline elements: Placing a
<div>inside a<span>or an<a>that doesn’t permit flow content in that context. -
Invalid list children: Putting
<div>,<p>, or other elements directly inside<ul>or<ol>, which only allow<li>(and<script>/<template>) as direct children. -
Invalid table structure: Placing
<td>directly inside<table>without wrapping it in<tr>, or putting non-table elements where only<thead>,<tbody>,<tfoot>, or<tr>are expected. -
Headings or paragraphs inside
<p>: The<p>element only accepts phrasing content, so nesting a<h2>or another<p>inside it is invalid. -
Interactive elements inside interactive elements: Nesting a
<button>inside an<a>, or an<a>inside a<button>.
To fix the issue, consult the MDN documentation for the parent element and check its Permitted content section. Then either move the child element to a valid location, wrap it in an appropriate intermediary element, or replace the parent or child with a more suitable element.
Examples
Invalid list children
A <ul> only permits <li> elements as direct children.
❌ Incorrect:
<ul>
<div>
<li>Item one</li>
<li>Item two</li>
</div>
</ul>
✅ Correct:
<ul>
<li>Item one</li>
<li>Item two</li>
</ul>
Block element inside a paragraph
The <p> element only accepts phrasing content. A <div> is flow content and cannot be nested inside it.
❌ Incorrect:
<p>
Here is some text.
<div class="highlight">This is highlighted.</div>
</p>
✅ Correct:
<p>Here is some text.</p>
<div class="highlight">This is highlighted.</div>
Or use a <span> if you want inline styling within the paragraph:
<p>
Here is some text.
<span class="highlight">This is highlighted.</span>
</p>
Invalid table structure
Table cells (<td>) must be inside a <tr>, which itself must be inside <thead>, <tbody>, <tfoot>, or directly inside <table>.
❌ Incorrect:
<table>
<td>Name</td>
<td>Age</td>
</table>
✅ Correct:
<table>
<tr>
<td>Name</td>
<td>Age</td>
</tr>
</table>
Interactive elements nested inside interactive elements
A <button> cannot be placed inside an <a> element, and vice versa, because interactive content cannot nest inside other interactive content.
❌ Incorrect:
<a href="/dashboard">
<button>Go to Dashboard</button>
</a>
✅ Correct (choose one or the other):
<a href="/dashboard">Go to Dashboard</a>
Or style a link to look like a button using CSS:
<a href="/dashboard" class="button">Go to Dashboard</a>
Wrapping elements inside <select>
The <select> element only allows <option>, <optgroup>, and scripting elements as children.
❌ Incorrect:
<select>
<div>
<option>Apple</option>
<option>Banana</option>
</div>
</select>
✅ Correct:
<select>
<optgroup label="Fruits">
<option>Apple</option>
<option>Banana</option>
</optgroup>
</select>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.