Thí dụ
Một bảng HTML đơn giản, chứa hai cột và hai hàng
Thêm các ví dụ "Tự mình thử" bên dưới
Định nghĩa và cách sử dụng
tag defines an HTML table.
An HTML table consists of one
element and one or more , element defines a table row, the , , , and elements.Browser Support
, andelements.The
element defines a table header, and theelement defines a table cell.An HTML table may also include
,ElementYesYesYesYesYesGlobal Attributes
The tag also supports the Global Attributes in HTML.
Event Attributes
The
tag also supports the Event Attributes in HTML.More Examples
Example
How to add collapsed borders to a table (with CSS):
ThángTiết kiệmTháng1$100Tháng hai$80
Example
How to right-align a table (with CSS):
Example
How to center-align a table (with CSS):
Example
How to add background-color to a table (with CSS):
Example
How to add padding to a table (with CSS):
Example
How to set table width (with CSS):
Example
How to create table headers:
Example
How to create a table with a caption:
Example
How to define table cells that span more than one row or one column:
Related Pages
HTML tutorial: HTML Tables
HTML DOM reference: Table Object
CSS Tutorial: Styling Tables
Default CSS Settings
Most browsers will display the element with the following default values:
Example
table {
display: table;
border-collapse: separate;
border-spacing: 2px;
border-color: gray;
}