English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML table rules attribute

The rules attribute specifies which parts of the internal borders should be displayed. For practical reasons, it is best not to specify any rules and instead use CSS.

 HTML <table> tag

Online Example

Only show the borders between rows:

<p>The table has rules="rows":</p>
<table rules="rows">
  <tr>
    <th>Grade</th>
    <th>Number of people</th>
  </tr>
  <tr>
    <td>Grade 3</td>
    <td>56</td>
  </tr>
</table>
<p>The table has rules="cols":</p>
<table rules="cols">
  <tr>
    <th>Grade</th>
    <th>Number of people</th>
  </tr>
  <tr>
    <td>Grade 3</td>
    <td>56</td>
  </tr>
</table>
<p>The table has rules="all":</p>
<table rules="all">
  <tr>
    <th>Grade</th>
    <th>Number of people</th>
  </tr>
  <tr>
    <td>Grade 3</td>
    <td>56</td>
  </tr>
</table>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the rules attribute.

Note:Internet Explorer 8 and earlier versions do not support the rules attribute of the <table> tag.

Note:Chrome and Safari display the property incorrectly: in addition to the inner border, the affected outer border will also be added.

Definition and usage

HTML5 The <table> rules attribute is not supported. Please use CSS instead.

The rules attribute specifies which part of the inner border is visible.

From a practical point of view, it is best not to specify rules, but to use CSS to add them borders (border style).

Syntax

<table rules="value">

Attribute value

ValueDescription
noneNo lines.
groupsLines between row and column groups.
rowsLines between rows.
colsLines between columns.
allLines between rows and columns.
 HTML <table> tag