HTML .lt;table> tags
Labels are used to define HTML tables, and a simple HTML table should consist of two rows and two columns, as shown in the following example:A simple HTML table with two columns and two rows:
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
Try it out . . .
(See bottom of page for more examples)
Browser support
All major browsers support the hashtag.
Label definition and instructions for use
Labels define HTML tables.
An HTML table includes one or more elements of the .lt;table>
The element defines the table row, the element defines the header, and the element defines the table unit.
More complex HTML tables may also include elements such as slt;caption>, slt;col;colgroup?gt;,?lt;thead>,?lt;tfoot> and .lt;tbody?gt;
The difference between HTML 4.01 and HTML5
In HTML5, only the "border" property is supported and only the value "1" or "" is allowed.
Property
Attributes | value | describe |
---|---|---|
align |
left
center right |
HTML5 does not support.HTML 4.01 has been discarded. Specifies the alignment of the table relative to the peripheral elements. |
bgcolor |
rgb(x,x,x)
#xxxxxx colorname |
HTML5 does not support.HTML 4.01 has been discarded. The background color of the specified table. |
border |
1
"" |
Specifies whether the table unit has a border. |
cellpadding | pixels | HTML5 does not support. The blank between the unit edge and its content is specified. |
cellspacing | pixels | HTML5 does not support. The blank between the cells is specified. |
frame |
void
above below hsides lhs rhs vsides box border |
HTML5 does not support. It is visible to which portion of the outer border is visible. |
rules |
none
groups rows cols all |
HTML5 does not support. It is visible to which portion of the inner side frame is visible. |
summary | text | HTML5 does not support. The summary of the specified form. |
width |
pixels
% |
HTML5 does not support. Specify the width of the table. |
Global properties
The label supports the global properties of HTML.
The event property
The tag supports the event properties of HTML.
Try it - instance
The title in the table
This example shows how to display the table title.
Empty cell
This example shows how to use to work with cells without content.
Table with title
This example shows a table with a title.
The label in the table
This example shows how to display elements within other elements.
Table cells that span rows or columns
This example shows how to define table cells that span rows or columns.
Related articles
HTML tutorial: HTML tables
HTML DOM Reference Manual: Table Objects