HTML Guides for unclosed element
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
A table can only hold another table inside one of its cells, so a <table> start tag placed directly inside an open table, outside any <td> or <th>, is an error.
Between <table> and </table>, HTML allows only table parts: <caption>, <colgroup>, <thead>, <tbody>, <tfoot> and <tr>. Content, a nested table included, goes in a <td> or <th> cell. When the parser meets a new <table> tag anywhere else in an open table, it closes the open table at that point and starts the new one after it. The two tables end up as siblings in the DOM, and the </table> written for the outer table has nothing left to close, so the validator also reports a stray end tag.
Two mistakes usually cause this. One is a missing </table>: a table never gets closed, and the next table on the page starts inside it. The other is a wrapper table with another table directly inside it and no <tr> or <td> in between, such as one left behind by a WYSIWYG editor.
Close the first table before the next one starts, or remove the extra wrapper. If you do want one table inside another, put the inner table in a <td> of the outer one. To center a table or add space around it, use CSS on the table itself instead of wrapping it in another table.
Invalid example
<table>
<table>
<tr>
<th>Day</th>
<th>Opening hours</th>
</tr>
<tr>
<td>Monday</td>
<td>9:00 to 17:00</td>
</tr>
</table>
</table>
Valid example
<table>
<tr>
<th>Day</th>
<th>Opening hours</th>
</tr>
<tr>
<td>Monday</td>
<td>9:00 to 17:00</td>
</tr>
</table>
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.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries