Latest web development tutorials

HTML DOM Table rules attribute

Table Object Reference Table Object

Definition and Usage

rules property sets or returns a table inside edge.

grammar

Setting rules properties:

tableObject.rules="none|groups|rows|cols|all"

Returns rules attributes:

tableObject.rules

描述
none 没有内部边界
groups 显示行组和列组之间的内部边界
rows 显示内部行之间的边界
cols 显示的列之间内部边界
all 显示行和列之间的内边界


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute rules

Note: IE9 can display this attribute correctly.Earlier versions of IE in addition to four internal borders, we will also add four outer boundary.

Note: Chrome and Safari correctly display this attribute: In addition to the outer inner border also affects external border.


Examples

Examples

The following example sets the form of two different internal edges:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function rows(){
    document.getElementById('myTable').rules="rows";
}
function cols(){
    document.getElementById('myTable').rules="cols";
}
</script>
</head>
<body>

<table id="myTable">
<tr>
        <td>cell 1</td>
        <td>cell 2</td>
</tr>
<tr>
        <td>cell 3</td>
        <td>cell 4</td>
</tr>
</table>
<br>
<button type="button" onclick="rows()">只显示行边界</button>
<button type="button" onclick="cols()">只显示列边界</button>
<p><b>注意:</b> rules属性在Internet Explorer 9之前版本不能正常显示。</p>

</body>
</html>

try it"


Table Object Reference Table Object