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

Live Demo
<!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 the following result −

Global Attributes

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

Specific Attributes

The HTML <table> tag also supports the following additional attributes −

Attribute Value Description
abbr abbreviated_text Deprecated − Specifies an abbreviated version of the content in a cell.
align right
left
center
justify
char
Deprecated − Visual alignment.
bgcolor rgb(x,x,x)
#hexcode
colorname
Deprecated − Specifies the background color of the table.
border pixels Deprecated − 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.
summary text Deprecated − 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

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes

html_tags_reference.htm

Advertisements