HTML <table> Tag
<table>tag defines an HTML table.
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.
- Example Code:
<table border="1"> <tr> <td>Cat</td> <td>Dog</td> </tr> <tr> <td>Mouse</td> <td>Bird</td> </tr> </table>
Cat Dog Mouse Bird
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. 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.
- void: None are displayed. This value is the default
- above: Top side of the frame
- below: Bottom side of the frame
- hsides: Top and bottom sides
- vsides: Right and left sides
- lhs: Left side
- rhs: Right side
- box: All sides
- border: All sides
rules Used in conjunction with the border attribute, specifies which rules appear between the cells of the table. Possible values:
- None: None are displayed. This value is the default
- groups: Rules appear between row groups and column groups
- rows: Between rows
- cols: Between columns
- all: Between all rows and columns
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
- Global Attributes:
<table>tag also supports the Global Attributes in HTML5
- Event Attributes:
<table>tag also supports the Event Attributes in HTML5
View All HTML Tags