About This HTML Issue
The <table> element in HTML has a rigid content model. Directly inside <table>, only specific elements are allowed: <caption>, <colgroup>, <thead>, <tbody>, <tfoot>, <tr>, and <script>-supporting elements. Similarly, <tr> elements may only contain <td> and <th> elements. A <br> tag placed between table rows, or directly inside a <tbody> or <tr> but outside a cell, violates this content model.
This error typically happens when developers try to add vertical spacing between table rows using <br> tags. Browsers handle this invalid markup inconsistently — some will push the <br> outside the table entirely, while others may silently ignore it. This leads to unpredictable layout behavior across browsers and can confuse assistive technologies that rely on proper table structure to convey data relationships to users.
The <br> element is only valid inside phrasing content contexts, such as within a <td>, <th>, <p>, <span>, or similar elements. If you need to add spacing between rows, use CSS (margin, padding, or border-spacing) instead of inserting <br> tags into the table structure.
How to fix it
-
Remove the
<br>if it was added accidentally or as a formatting attempt between rows. -
Move the
<br>inside a<td>or<th>if you intended it to create a line break within a cell’s content. -
Use CSS for spacing if you need visual separation between rows. Apply
paddingto cells or use theborder-spacingproperty on the table.
Examples
❌ Invalid: <br> between table rows
<table>
<tr>
<th>Item</th>
<th>Description</th>
</tr>
<br>
<tr>
<td>Book</td>
<td>A guide to HTML</td>
</tr>
</table>
❌ Invalid: <br> directly inside a <tr>
<table>
<tr>
<br>
<td>Book</td>
<td>A guide to HTML</td>
</tr>
</table>
✅ Fixed: <br> removed, CSS used for spacing
<table style="border-spacing: 0 1em;">
<tr>
<th>Item</th>
<th>Description</th>
</tr>
<tr>
<td>Book</td>
<td>A guide to HTML</td>
</tr>
</table>
✅ Valid: <br> used inside a table cell
A <br> element is perfectly valid inside a <td> or <th>, where it functions as a line break within the cell’s content.
<table>
<tr>
<th>Item</th>
<th>Description</th>
</tr>
<tr>
<td>Book</td>
<td>
Title: HTML & CSS<br>
Author: Jon Duckett
</td>
</tr>
</table>
✅ Fixed: Using padding for row spacing
If your goal is to create visual separation between rows, CSS padding on cells is the cleanest approach:
<style>
.spaced-table td,
.spaced-table th {
padding: 1em 0.5em;
}
</style>
<table class="spaced-table">
<tr>
<th>Item</th>
<th>Description</th>
</tr>
<tr>
<td>Book</td>
<td>A guide to HTML</td>
</tr>
</table>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.