About This HTML Issue
The border attribute on the <table> element is obsolete in HTML5 and should be replaced with CSS styling.
The border attribute was commonly used in older HTML to add borders to tables. In HTML5, the only valid value for the border attribute on a <table> is an empty string ("") or "1", and even then it’s considered obsolete. The validator message mentions img { border: 0; } because the border attribute was also frequently used on <img> elements, but the same principle applies to tables — presentational attributes should be replaced with CSS.
To style table borders, use the CSS border property on the <table>, <th>, and <td> elements. The border-collapse property is also useful for controlling whether borders are merged or separated.
HTML Examples
❌ Invalid: using the obsolete border attribute
<table border="2">
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>
✅ Valid: using CSS for borders
<style>
table, td {
border: 2px solid black;
border-collapse: collapse;
}
</style>
<table>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.