# Create a table in HTML

HTMLWeb DevelopmentFront End Technology

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

The following are the 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.
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.

## Example

You can try to run the following code to create a table in HTML −

<!DOCTYPE html>
<html>
<style>
table, th, td {
border: 1px solid black;
}
</style>
<body>
<h3>Ranking</h3>
<table>
<th>Rank</th>
<tr>
<td>One</td>
</tr>
<tr>
<td>Two</td>
</tr>
</table>
</body>
</html>
Published on 13-Mar-2018 10:19:03