| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
Note: The rules attribute cannot be displayed properly in versions of Internet Explorer before 9.
``` **HTML Table rules Attribute** **Table Object** **Definition and Usage** `rules` attribute is used to set or return the internal borders of a table. **Syntax** Set `rules` attribute: ```javascript tableObject.rules="none|groups|rows|cols|all" ``` Return `rules` attribute: ```javascript tableObject.rules ``` **Value Description** - `none`: No internal borders. - `groups`: Display internal borders between row groups and column groups. - `rows`: Display borders between internal rows. - `cols`: Display internal borders between columns. - `all`: Display internal borders between rows and columns. **Browser Support** All major browsers support the `rules` attribute. **Note**: IE9 can correctly display this attribute. Earlier versions of IE, in addition to the four internal borders, also add four external borders. **Note**: Chrome and Safari can correctly display this attribute: in addition to affecting the inner border, it also affects the outer border. **Example** **Example** The following example sets two different internal borders for the table: ```html function rows(){ document.getElementById('myTable').rules="rows"; } function cols(){ document.getElementById('myTable').rules="cols"; }| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
Note: The rules attribute cannot be displayed properly in versions of Internet Explorer before 9.
``` Try it yourself Β»
YouTip