English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Two HTML tables demonstration:
<!doctype html> <html> <head> <meta charset="UTF-8<table border=" <title>HTML Table Tag Usage (Basic Tutorial Website oldtoolbag.com)html>/Test to see ‹
Browser compatibilityIEFirefoxOperaChrome
Safari
tag definition and usage instructions
<table> tag defines an HTML table An HTML table includes a <table> element, one or more<tr>, <th> and <td>
elements.
<tr> elements define table rows, <th> elements define table headers, and <td> elements define table cells.
differences between5 In HTML, only the "border" attribute is supported, and only the value "1" or ""
Attribute | Value | Description |
---|---|---|
align | left center right | HTML5 Not supported. HTML 4.01 Deprecated. Specify the alignment of the table relative to surrounding elements. |
bgcolor | rgb(x,x,x) #xxxxxx colorname | HTML5 Not supported. HTML 4.01 Deprecated. Specify the background color of the table. |
border | 1 "" | Specify whether the table cell has a border. |
cellpadding | pixels | HTML5 Not supported. Specify the spacing between the cell border and its content. |
cellspacing | pixels | HTML5 Not supported. Specify the spacing between cells. |
frame | void above below hsides lhs rhs vsides box border | HTML5 Not supported. Specify which part of the outer border is visible. |
rules | none groups rows cols all | HTML5 Not supported. Specify which part of the inner border is visible. |
summary | text | HTML5 Not supported. Specifies the summary of the table. |
width | pixels % | HTML5 Not supported. Specifies the width of the table. |
The <table> tag supports Global Attributes of HTML.
The <table> tag supports HTML Event Attributes.
Table Without Borders
This example demonstrates a table without borders.
Table Header (Heading) in the Table
This example demonstrates how to display the table header.
Table with Caption
This example demonstrates a table with a caption (caption).
Table Cells Spanning Rows or Columns
This example demonstrates how to define table cells that span rows or columns.
Tags within Tables
This example demonstrates how to display elements within different elements.
Cell Padding
This example demonstrates how to use Cell padding to create space between the cell content and its border.
Cell Spacing
This example demonstrates how to use Cell spacing to increase the distance between cells.
HTML Tutorial:HTML Tables
HTML DOM Reference Manual:Table Object