This element creates a table that can contain rows and columns.
The <tr>
element creates rows in the table.
The <td>
element creates the cells in each table row.
<table> |
Yes | Yes | Yes | Yes | Yes |
The "align", "bgcolor", "border", "cellpadding", "cellspacing", "frame", "rules", "summary", and "width" attributes are deprecated in HTML5.
Attribute | Value | Description |
---|---|---|
align | left center right |
Not supported in HTML5. Set the alignment of a table |
bgcolor | rgb(x,x,x) #xxxxxx colorname |
Not supported in HTML5. Set the table background color |
border | 1 "" |
Not supported in HTML5. Set whether the table cells should have borders or not |
cellpadding | pixels | Not supported in HTML5. Set the space between the cell wall and the cell content |
cellspacing | pixels | Not supported in HTML5. Set the space between cells |
frame | void above below hsides lhs rhs vsides box border |
Not supported in HTML5. Set which parts of the outside borders that should be visible |
rules | none groups rows cols all |
Not supported in HTML5. Set which parts of the borders that should be visible |
sortable | sortable | the table should be sortable |
summary | text | Not supported in HTML5. Create a summary of the table content |
width | pixels % |
Not supported in HTML5. Set the width of a table |
The <table> tag supports the Global Attributes in HTML.
The <table> tag supports the Event Attributes in HTML.
table { display: table; border-collapse: separate; border-spacing: 2px; border-color: gray; }
A demo showing how to use <table> tag.
<html>
<body>
<table>
<tr>
<td>col 1: maroon</td>
<td>col 2: red</td>
<tr>
<td>col 1: maroon</td>
<td>col 2: red</td>
</tr>
</table>
</body><!--from w w w . j av a 2s. c o m-->
</html>