Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

What is the rule attribute in HTML Table ?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

This is an HTML attribute, that is used to specify which parts of the inside borders should be visible. The HTML rule attribute is applicable on table tags. The <table> rules attribute is not supported by HTML 5.

Syntax:

<table rules="value">

Attributes: This attribute accepts 5 values all are mentioned and described below.

  • none: It does not create any lines.
  • groups: It creates lines between row and column groups.
  • rows: It creates a line between the rows.
  • cols: It creates lines between the columns.
  • all: It creates lines between the rows and columns.

Example: The below example illustrates the rule attribute in HTML.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <style>
        h1 {
            color: green;
        }
    </style>
</head>
  
<body>
    <center>
    <h1>GeeksforGeeks</h1>
  
    <h2>What is rule attribute in HTML Table?</h2>
  
    <table rules="rows">
        <tr>
            <th>NAME</th>
            <th>AGE</th>
            <th>BRANCH</th>
        </tr>
        <tr>
            <td>BITTU</td>
            <td>22</td>
            <td>CSE</td>
        </tr>
    </table>
    <br>
    <table rules="cols">
        <tr>
            <th>NAME</th>
            <th>AGE</th>
            <th>BRANCH</th>
        </tr>
        <tr>
            <td>BITTU</td>
            <td>22</td>
            <td>CSE</td>
        </tr>
    </table>
    <br>
    <table rules="all">
        <tr>
            <th>NAME</th>
            <th>AGE</th>
            <th>BRANCH</th>
        </tr>
        <tr>
            <td>BITTU</td>
            <td>22</td>
            <td>CSE</td>
        </tr>
    </table>
    </center>
</body>
  
</html>


Output:

HTML rule attribute in HTML Table


My Personal Notes arrow_drop_up
Last Updated : 13 Jan, 2022
Like Article
Save Article
Similar Reads
Related Tutorials