Skip to main content
HTML Validation

The “border” attribute on the “table” element is obsolete. Consider specifying “img { border: 0; }” in CSS instead.

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.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

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.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries