Table Elements and Attributes part 2(rules, summary, width)
Table of Content:
We already discuss about these below attributes
- The
align
Attribute - The
bgcolor
Attribute - The
border
Attribute - The
cellpadding
Attribute - The
cellspacing
Attribute - The
dir
Attribute - >The
frame
Attribute
- The
<table>
Element Creates a Table - The
align
Attribute - The
bgcolor
Attribute - The
border
Attribute - The
cellpadding
Attribute - The
cellspacing
Attribute - The
dir
Attribute - The
frame
Attribute - The
rules
Attribute - The
summary
Attribute - The
width
Attribute - The
<tr>
Element Contains Table Rows - The
align
Attribute - The
bgcolor
Attribute - The
char
Attribute - The
charoff
Attribute - The
valign
Attribute - The
<td>
and<th>
Elements Represent Table Cells - The
abbr
Attribute - The
align
Attribute - The
axis
Attribute - The
bgcolor
Attribute - The
char
Attribute - The
charoff
Attribute - The
colspan
Attribute - The
headers
Attribute - The
height
Attribute - The
nowrap
Attribute - The
rowspan
Attribute - The
scope
Attribute - The
valign
Attribute - The
width
Attribute - Adding a
<caption>
to a Table - Spanning Columns Using the
colspan
Attribute - Spanning Rows Using the
rowspan
Attribute - Splitting Up Tables Using a Head, Body, and Foot
- Grouping Columns Using the
<colgroup>
Element - Columns Sharing Styles Using the
<col>
Element - Nested Tables
The rules
Attribute
The rules attribute is used to indicate which inner borders of the table should be displayed.
rules="ruleType"
The following table shows the possible values for the rules attribute:
Value | Purpose |
none | No inner borders (the default) |
groups | Displays inner borders between all table groups (groups are created by the <thead> , <tbody> , <tfoot> , and <colgroup> elements) |
rows | Displays horizontal borders between each row |
cols | Displays vertical borders between each column |
all | Displays horizontal and vertical borders between each row and column |
Support for this attribute is not perfect, and it has been deprecated in favor of the CSS border property, which achieves better results.
Examples one by one
Example 1: rules="none"
Name | Food |
---|---|
Jakir | Rasgola |
Sabir | Masala Dosa |
Sourav | Biryani |
Rohan | Chole Batura |
Rumman | Birayani |
Live Preview
Example 2: rules="groups"
Name | Food |
---|---|
Jakir | Rasgola |
Sabir | Masala Dosa |
Sourav | Biryani |
Rohan | Chole Batura |
Rumman | Birayani |
Live Preview
Example 3: rules="rows"
Name | Food |
---|---|
Jakir | Rasgola |
Sabir | Masala Dosa |
Sourav | Biryani |
Rohan | Chole Batura |
Rumman | Birayani |
Live Preview
Example 4: rules="cols"
Name | Food |
---|---|
Jakir | Rasgola |
Sabir | Masala Dosa |
Sourav | Biryani |
Rohan | Chole Batura |
Rumman | Birayani |
Live Preview
Example 5: rules="all"
Name | Food |
---|---|
Jakir | Rasgola |
Sabir | Masala Dosa |
Sourav | Biryani |
Rohan | Chole Batura |
Rumman | Birayani |
Live Preview
The summary
Attribute
The summary
attribute is used to provide additional information about the <table> element. Unfortunately,
this element is not allowed in HTML5. So, how can we provide this additional summary information?
The simplest solution is to provide the additonal information directly above or below the table element.
Sydney | Canberra | |
---|---|---|
January | 18mm | 20mm |
February | 7mm | 9mm |
Live Preview
The width
Attribute
The width attribute is used to specify the width of the table, and usually its value is given in pixels.
width="500"width="70%"
Name | Food |
---|---|
Jakir | Rasgola |
Sabir | Masala Dosa |
Sourav | Biryani |
Rohan | Chole Batura |
Rumman | Birayani |
Live Preview
The height
Attribute
The height attribute is used to specify the height of the table, and usually its value is given in pixels.
height="500"height="70%"
Name | Food |
---|---|
Jakir | Rasgola |
Sabir | Masala Dosa |
Sourav | Biryani |
Rohan | Chole Batura |
Rumman | Birayani |