<

HTML <table> Tag

The <table> tag defines an HTML table.An HTML table consists of the <table> element and one or more <tr>, <th>, and <td> elements.

The <tr> element defines a table row, the <th> element defines a table header, and the element defines a table cell.

Attributes



Attribute Value Description
align left
center
right
Not supported in HTML5.
Specifies the alignment of a table according to surrounding text
bgcolor rgb(x,x,x)
#xxxxxx
colorname
Not supported in HTML5.
Specifies the background color for a table
border 1
0
Not supported in HTML5.
Specifies whether or not the table is being used for layout purposes
cellpadding pixels Not supported in HTML5.
Specifies the space between the cell wall and the cell content
cellspacing pixels Not supported in HTML5.
Specifies the space between cells
frame void
above
below
hsides
lhs
rhs
vsides
box
border
Not supported in HTML5.
Specifies which parts of the outside borders that should be visible
rules none
groups
rows
cols
all
Not supported in HTML5.
Specifies which parts of the inside borders that should be visible
summary text Not supported in HTML5.
Specifies a summary of the content of a table
width pixels
%
Not supported in HTML5.
Specifies the width of a table


Example




<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid red;
}
</style>
</head>
<body>

<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

</body>
</html>
















© copyright 2017-2022 Completedone pvt ltd.