HTML Table Elements and Attributes: Rules, Summary, Width (Part 2)
Table of Content:
We already discuss about these below attributes
- The
alignAttribute - The
bgcolorAttribute - The
borderAttribute - The
cellpaddingAttribute - The
cellspacingAttribute - The
dirAttribute - >The
frameAttribute
- The
<table>Element Creates a Table - The
alignAttribute - The
bgcolorAttribute - The
borderAttribute - The
cellpaddingAttribute - The
cellspacingAttribute - The
dirAttribute - The
frameAttribute - The
rulesAttribute - The
summaryAttribute - The
widthAttribute - The
<tr>Element Contains Table Rows - The
alignAttribute - The
bgcolorAttribute - The
charAttribute - The
charoffAttribute - The
valignAttribute - The
<td>and<th>Elements Represent Table Cells - The
abbrAttribute - The
alignAttribute - The
axisAttribute - The
bgcolorAttribute - The
charAttribute - The
charoffAttribute - The
colspanAttribute - The
headersAttribute - The
heightAttribute - The
nowrapAttribute - The
rowspanAttribute - The
scopeAttribute - The
valignAttribute - The
widthAttribute - Adding a
<caption>to a Table - Spanning Columns Using the
colspanAttribute - Spanning Rows Using the
rowspanAttribute - 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 |
Live Preview