What is the rule attribute in HTML Table ?
Last Updated :
13 Jan, 2022
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
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...