HTML <table> Tag
Description:
The <table> tag defines an HTML table.
A simple HTML table consists of the table element and one or more tr, th, and td elements.
The tr element defines a table row, the th element defines a table header, and the td element defines a table cell.
A more complex HTML table may also include caption, col, colgroup, thead, tfoot, and tbody elements.
Specific Attributes:
| Attribute | Definition |
| summary | Provides a summary of the table's structure and purpose for non-visual user agents. |
| align | Visual alignment of the table (i.e. left, center, right). This attribute is deprecated, use CSS instead. |
| width | Width of the table. |
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Specifies an inline style for an element. |
| bgcolor | Background color of the table. |
| frame | Used in conjunction with the border attribute,
specifies which side of the frame that makes up the
border surrounding the table is displayed. Possible values:
|
| rules | Used in conjunction with the border
attribute, specifies which rules appear between the
cells of the table. Possible values:
|
| border | Specifies the width of the border around the table. For no border, use 0 (zero). |
| cellspacing | Specifies the space between cells. |
| cellpadding | Specifies the space between the cell borders and their contents |
Example Code:
<table border="1">
<tr>
<td>Cat</td>
<td>Dog</td>
</tr>
<tr>
<td>Mouse</td>
<td>Bird</td>
</tr>
</table>
Result
| Cat | Dog |
| Mouse | Bird |