rules (HTML attribute)
Example
The rules
attribute for this table is set to
"rows":
<table rules="rows">
<tr>
<th>Account Type</th>
<th>Interest Rate</th>
</tr>
<tr>
<td>Smart</td>
<td>From 2%</td>
</tr>
<tr>
<td>Young Saver</td>
<td>From 1.6%</td>
</tr>
</table>
Description
The rules
attribute allows you to set borders (also called rules, surprise,
surprise!) inside the table at the boundaries between
cells. For example, you can set the rules to
"rows", as you can see in Figure 1. This practice creates the dividing
lines, but doesn’t affect the table’s border (for that, you’d use the
frame attribute—the rules
attribute’s partner in crime—or the border
attribute).
rules attributes are
set to "rows", "cols", and
"all"
Value
The recognized attribute values are as shown in the syntax section.
Compatibility
| IE | 5.5 | Buggy |
|---|---|---|
| 6.0 | Buggy | |
| 7.0 | Buggy | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | None |
| 2.0 | None | |
| 3.0 | Buggy | |
| Opera | 9.2 | Full |
Most browsers tested
do something with this attribute's values (with the exception of
Safari 1 and 2, which ignore them completely), but there were still some
problems. Internet Explorer insists on adding a border around the table,
not just to the boundaries between table cells; Safari 3 doesn’t apply a
border around the table, but adds a border on the outside edges of the
affected cells, unlike Firefox, which adds the correct border. The
differences are demonstrated in Figure 2,
which shows the rendering of the table markup in the example HTML above
(rules="rows") compared in the three browsers
mentioned.
rules attribute in action, as viewed
in Firefox, Safari, and Internet Explorer
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

