You are here: Reference > HTML > attributes > rules (table)

rules attribute (table)

Browser support:
Specifies which borders will appear between cells within a table.
This attribute has effect only when the border attribute is set as well.
JavaScript page for this attribute: rules. You can find other example(s) there.

Possible values:

String that sets the type of border rules in a table.
One of the following values:
all
Borders on all rows and columns are displayed .
cols
Borders are only displayed between columns.
groups
Horizontal borders between all tHead, tBody, and tFoot objects; vertical borders between all col and colGroup objects are displayed.
none
Borders are not displayed.
rows
Borders are only displayed between rows.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the rules attribute:
<table id="myTable" border="3px" rules="cols">
    <thead>
        <tr>
            <th>Fruit</th>
            <th>Cost</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Apple</td>
            <td>$5</td>
        </tr>
        <tr>
            <td>Pear</td>
            <td>$10.50</td>
        </tr>
    </tbody>
</table>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content