The rules attribute of the TABLE element specifies which rules (inner borders) are displayed.
<table rules="none"></table>
Attribute |
Value |
Explanation |
rules=" " |
none |
removes all inner borders |
rows |
displays borders between rows only |
cols |
displays borders between columns only |
groups |
displays borders between groups only |
all |
displays borders between all cells |
Example
none (Removes all inner borders)
<table border="5" rules="none">
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
<tr>
<td>Row3 - Col1</td>
<td>Row3 - Col2</td>
<td>Row3 - Col3</td>
</tr>
</table>
- Output
-
Row1 - Col1 |
Row1 - Col2 |
Row1 - Col3 |
Row2 - Col1 |
Row2 - Col2 |
Row2 - Col3 |
Row3 - Col1 |
Row3 - Col2 |
Row3 - Col3 |
rows (Displays borders between rows only)
<table border="5" rules="rows">
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
<tr>
<td>Row3 - Col1</td>
<td>Row3 - Col2</td>
<td>Row3 - Col3</td>
</tr>
</table>
- Output
-
Row1 - Col1 |
Row1 - Col2 |
Row1 - Col3 |
Row2 - Col1 |
Row2 - Col2 |
Row2 - Col3 |
Row3 - Col1 |
Row3 - Col2 |
Row3 - Col3 |
cols (Displays borders between columns only)
<table border="5" rules="cols">
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
<tr>
<td>Row3 - Col1</td>
<td>Row3 - Col2</td>
<td>Row3 - Col3</td>
</tr>
</table>
- Output
-
Row1 - Col1 |
Row1 - Col2 |
Row1 - Col3 |
Row2 - Col1 |
Row2 - Col2 |
Row2 - Col3 |
Row3 - Col1 |
Row3 - Col2 |
Row3 - Col3 |
groups (Displays borders between groups only)
<table border="5" rules="groups">
<thead>
<tr>
<th colspan="3">Table Header</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3">Table Footer</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
<tr>
<td>Row3 - Col1</td>
<td>Row3 - Col2</td>
<td>Row3 - Col3</td>
</tr>
</tbody>
</table>
- Output
-
Table Header |
Table Footer |
Row1 - Col1 |
Row1 - Col2 |
Row1 - Col3 |
Row2 - Col1 |
Row2 - Col2 |
Row2 - Col3 |
Row3 - Col1 |
Row3 - Col2 |
Row3 - Col3 |
all (Displays borders between all cells)
<table border="5" rules="all">
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
<tr>
<td>Row3 - Col1</td>
<td>Row3 - Col2</td>
<td>Row3 - Col3</td>
</tr>
</table>
- Output
-
Row1 - Col1 |
Row1 - Col2 |
Row1 - Col3 |
Row2 - Col1 |
Row2 - Col2 |
Row2 - Col3 |
Row3 - Col1 |
Row3 - Col2 |
Row3 - Col3 |