Table Tags in HTML
Table Tags in HTML
Sl No. Tag Attribute Attribute Values Default Value Description/Purpose Syntax Type of Tag
1 <table> used to define a table <table>………</table> Container Tag
Border numbers 0 specify the size of the border for the table <table border = "any number">
Bordercolor any color Black specify the color of the border <table bordercolor = "color_name">
cellpadding any number used to add more space inside each cell <table cellpadding = "any number">
cellspacing any number used to add more space around each cell <table cellspacing = "any number">
background set an image as the background of the table <table background = "URL of the image">
bgcolor any color white set a background color to the table <table bgcolor = "color_name">
specifies the width of the table
Width in pixels (%) (Important Note: This attribute is not supported in <table width = "pixels%">
HTML5)
2 <caption> NA defines the caption to a table <caption> Caption to be given </Caption> Container Tag
3 <tr> (Table Row) used to define a table row <tr>…………………………</tr> Container Tag
Bordercolor anycolor black specifies the border color to rows and columns <tr bordercolor = "color_name">
Bgcolor anycolor white specifies the background color to rows and columns <tr bgcolor = "color_name">
Height any number specifies the height of the rows <tr height = "value" >
align left / center / right left specifies the alignment of the cell horizontally <tr align = "choice of alignment">
valign top / middle / bottom bottom specifies the alignment of the cell vertically <tr valign = "choice of alignment">
Bgcolor anycolor white specifies the background color to rows and columns <td/th bgcolor = "color_name">
Height any number specifies the height of the rows <td/th height = "value" >
align left / center / right left specifies the alignment of the cell horizontally <td/th align = "choice of alignment">
valign top / middle / bottom bottom specifies the alignment of the cell vertically <td/th valign = "choice of alignment">
Colspan any number 0 extends the cell horizontally <td/th colspan = "value" >
rowspan any number 0 extends the cell vertictally <td/th rowspan = "value" >