HTML <table> Tag

Advertisements


Description

The HTML <table> tag is used for defining a table. The table tag contains other tags that define the structure of the table.

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML table Tag</title>
</head>
<body>
<table border="1">
  <tr>
    <th>Team</th>
    <th>Ranking</th>
  </tr>
  <tr>
    <td>India</td>
    <td>1</td>
  </tr>
  <tr>
    <td>South Africa</td>
    <td>2</td>
  </tr>
  <tr>
    <td>Australia</td>
    <td>3</td>
  </tr>
</table>
</body>
</html>

This will produce following result:

Team Ranking
India 1
South Africa 2
Australia 3

Global Attributes

This tag supports all the global attributes described in - HTML Attribute Reference

Specific Attributes

The HTML <table> tag also supports following additional attributes:

AttributeValueDescription
abbr abbreviated_textDeprecated-Specifies an abbreviated version of the content in a cell.
alignright
left
center
justify
char
Deprecated-Visual alignment.
bgcolor rgb(x,x,x)
#hexcode
colorname
Deprecated-Specifies the background color of the table.
border pixelsDeprecated-Specifies the border width. A value of "0" means no border.
cellpadding pixels or %Deprecated-Specifies the space between the cell borders and their contents.
cellspacing pixels or %Deprecated-Specifies the space between cells.
frame void
above
below
hsides
lhs
rhs
vsides
box
border
Deprecated-Used in conjunction with the border attribute, specifies which side of the frame that makes up the border surrounding the table is displayed.
rules none
groups
rows
cols
all
Deprecated-Used in conjunction with the border attribute, specifies which rules appear between the cells of the table.
summarytextDeprecated-Specifies the summary of the content.
width pixels or %Deprecated-Specifies the width of the table.

Event Attributes

This tag supports all the event attributes described in - HTML Events Reference

Browser Support

ChromeFirefoxIEOperaSafariAndroid
YesYesYesYesYesYes

html_tags_reference.htm

Advertisements