👀 Live Preview
Table styled with CSS (the reliable modern approach). Legacy rules may not render in your browser:
| Name | Age |
|---|---|
| John | 30 |
| Jane | 25 |
Use CSS borders instead of obsolete rules for production tables.

The rules attribute on <table> once controlled which internal grid lines were drawn — between rows, columns, groups, or all cells. Values include none, rows, cols, groups, and all. Important: rules is obsolete in HTML5 and modern browsers often ignore it. Use CSS borders on th and td instead. This tutorial explains rules for reading legacy HTML and understanding how it differs from validation “rules” in other technologies.
Grid lines.
Scope.
none to all.
HTML5.
Legacy JS.
Modern way.
rules AttributeIn HTML 4, the rules attribute let authors choose which internal borders appeared inside a table — horizontal lines only (rows), vertical only (cols), lines between row/column groups (groups), every cell edge (all), or none at all (none).
It was often used together with the legacy border attribute on <table> to control the outer frame versus inner grid lines. Today, CSS gives full control over table borders with predictable results across browsers.
Do not rely on rules for production table styling. Use border-collapse: collapse and cell borders in CSS instead.
Legacy syntax on <table> (historical reference):
<table border="1" rules="rows">
<thead>...</thead>
<tbody>...</tbody>
</table>
<!-- Modern equivalent -->
<table class="data-table">...</table><table> elements.none, groups, rows, cols, all.none when omitted.border and frame on the same table.groups expects structural groups like thead, tbody, colgroup.tableElement.rules = "cols" (string property).The rules attribute accepts these keyword values:
rules="none" — No internal borders (default).rules="rows" — Borders between rows only.rules="cols" — Borders between columns only.rules="groups" — Borders between row groups and column groups.rules="all" — Borders between all rows and columns.<table rules="rows">...</table> <!-- horizontal lines -->
<table rules="cols">...</table> <!-- vertical lines -->
<table rules="all">...</table> <!-- full grid -->
<table rules="groups">...</table> <!-- group separators -->With rules="rows", the browser was meant to draw horizontal dividers between table rows. In modern browsers this effect is unreliable or absent — CSS achieves the same result consistently.
| Value | Legacy effect | Today |
|---|---|---|
none | No internal lines | Default; use CSS if needed |
rows | Horizontal dividers | CSS border-bottom on tr/td |
cols | Vertical dividers | CSS border-right on cells |
groups | Between thead/tbody/colgroup | CSS on group sections |
all | Full internal grid | CSS border + border-collapse |
table.rules | JS string property | Little visual effect now |
| Element | Supports rules? | Notes |
|---|---|---|
<table> | Yes (legacy) | Only standard element for rules |
<td>, <th> | No | Style cells with CSS borders |
<textarea> | No | Use rows for textarea height |
<form> | No | Not a form validation attribute |
rules vs modern CSS| Goal | Legacy HTML | Modern CSS |
|---|---|---|
| Row dividers | rules="rows" | td { border-bottom: 1px solid #cbd5e1; } |
| Column dividers | rules="cols" | td { border-right: 1px solid #cbd5e1; } |
| Full grid | rules="all" | table { border-collapse: collapse; } td, th { border: 1px solid #cbd5e1; } |
| Outer frame only | frame + border | table { border: 1px solid #cbd5e1; } |
| Browser support | Inconsistent / ignored | Reliable everywhere |
Legacy rules="rows" markup, dynamic table.rules in JavaScript, and the modern CSS border replacement.
Table styled with CSS (the reliable modern approach). Legacy rules may not render in your browser:
| Name | Age |
|---|---|
| John | 30 |
| Jane | 25 |
Use CSS borders instead of obsolete rules for production tables.
rules="rows" (legacy)Historical markup for horizontal internal borders:
<table border="1" rules="rows">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>30</td>
</tr>
<tr>
<td>Jane</td>
<td>25</td>
</tr>
</tbody>
</table>rules="rows" was intended to show horizontal lines between rows only. Modern browsers often render all borders from border="1" instead, or no special rules styling at all.
Legacy DOM property table.rules:
<table id="dynamicTable" border="1">...</table>
<script>
document.getElementById("dynamicTable").rules = "cols";
</script>table.rules = "cols" was meant to switch to column-only dividers. For dynamic styling today, toggle CSS classes on the table instead.
Achieve reliable row borders with CSS:
<style>
.data-table {
border-collapse: collapse;
width: 100%;
max-width: 360px;
}
.data-table th,
.data-table td {
border: 1px solid #cbd5e1;
padding: 0.55rem 0.75rem;
text-align: left;
}
.data-table th {
background: #f1f5f9;
}
</style>
<table class="data-table">
<thead>
<tr><th>Name</th><th>Age</th></tr>
</thead>
<tbody>
<tr><td>John</td><td>30</td></tr>
<tr><td>Jane</td><td>25</td></tr>
</tbody>
</table>CSS border-collapse: collapse plus cell borders gives you full control — the correct approach for all new table designs.
rules.rules semantics.<th> and scope for screen readers.<caption> describes the table purpose.Pick rows, cols, all, groups, or none.
Internal lines per keyword (HTML 4).
Presentational attrs dropped.
Reliable styling today.
The rules attribute is obsolete. Browsers may still parse it in the DOM, but it has little or no visual effect in modern user agents.
rules is legacy onlyStyle table borders with CSS for consistent cross-browser results.
Bottom line: Learn rules for legacy HTML — style tables with CSS in all new projects.
border-collapse and cell borders for table gridsrules only when reading old HTML 4 tablesrules with CSS when refactoring sitesthead, tbody, and th scope for structurerules to new table markuprules across browsersrules with form or JSON validation rulesborder="1" alone for production designThe rules attribute once controlled internal table border lines with keywords like rows, cols, and all.
It is obsolete in HTML5. For every practical purpose today, use CSS to style table borders with full control and reliable browser support.
rulesBookmark these when reading legacy tables.
Internal lines.
Scopenone to all.
ValuesHTML5.
StatusModern fix.
TodayNot JSON rules.
Gotcharules is obsolete. Use CSS borders on table cells instead.none (default), groups, rows, cols, and all.rules is a legacy table presentation attribute. Form validation and JSON Schema “rules” are unrelated concepts.tableElement.rules = "rows" — the property exists but rarely changes appearance in modern browsers.border-collapse: collapse on the table and border on th and td elements.Understand obsolete rules markup, then style borders with CSS for reliable table layouts.
3 people found this page helpful