English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Encyclopedia

HTML: <table> tag

Online Example

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

All mainstream browsers support the <table> tag.

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.

HTML 4.01 More complex HTML tables may also include <caption>, <col>, <colgroup>, <thead>, <tfoot>, and <tbody> elements.5and HTML

differences between5 In HTML, only the "border" attribute is supported, and only the value "1" or ""

Attribute

AttributeValueDescription
alignleft
center
right
HTML5 Not supported. HTML 4.01 Deprecated. Specify the alignment of the table relative to surrounding elements.
bgcolorrgb(x,x,x)
#xxxxxx
colorname
HTML5 Not supported. HTML 4.01 Deprecated. Specify the background color of the table.
border1
""
Specify whether the table cell has a border.
cellpaddingpixelsHTML5 Not supported. Specify the spacing between the cell border and its content.
cellspacingpixelsHTML5 Not supported. Specify the spacing between cells.
framevoid
 above
 below
 hsides
 lhs
 rhs
 vsides
 box
 border
HTML5 Not supported. Specify which part of the outer border is visible.
rulesnone
 groups
 rows
 cols
 all
HTML5 Not supported. Specify which part of the inner border is visible.
summarytextHTML5 Not supported. Specifies the summary of the table.
widthpixels
 %
HTML5 Not supported. Specifies the width of the table.

Global Attributes

The <table> tag supports Global Attributes of HTML.

Event Attributes

The <table> tag supports HTML Event Attributes.

More Online Examples

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.

Related Articles

HTML Tutorial:HTML Tables

HTML DOM Reference Manual:Table Object