Table Tag in HTML | Attributes of Table Tag | Important Tags in HTML

Table Tag

 

Like us on Facebook to get more updates





<TABLE> tag defines a table. If you want to draw a table in your web page then you should use table tag in your source code. If you want to draw table then you should know <TH> tag, <TR> tag and <TD> tag.  Here <TH> tag defines a table header and <TR> tag defines table row and <TD> tag defines table data.

Table Tag:

TAG Description
<table> It defines a table.
<th> It defines a table header.
<td> It defines a table data.
<tr> It defines a table row.





Some Attributes of Table Tag:

  1. Border: Border attribute specifies the width of the border of the table. If you want to draw border in your table then you should use border attribute in table tag.
  2. Cellpadding: Cellpadding attribute specifies the space between the cell wall and the cell content.
  3. Cellspacing: Cellspacing attribute specifies the space between two cells. If you want to leave some space in two cells then you should use Cellspacing attribute in table tag.
  4. Align: Align attribute specifies the alignment of values in a table. It can be align a value in left, right and centre.
  5. Width: Width attribute specifies the width of a table. If you want to set width of a table then you should use width attribute in table tag.
  6. Bgcolor: Bgcolor attribute specifies the background color of a table. If you want to use a background color in your table then you should use bgcolor attribute in table tag.





Attributes for <th> and <td> tag:

Attribute Name Type of Value
Align Left, Right, Centre
Bgcolor Color name, rgb(), hexcode
Colspan Number
Rowspan Number
Height Pixel or Percentage
Valign Top, Middle, Bottom
Width Pixel or Percentage

 

Source Code of Table Tag is given below:

<html>

<head>

<title>Table Tag in HTML</title>

</head>

<body>

<table border=”2px” bgcolor=”sky blue” cellspacing=0px cellpadding=5px width=400>

<tr>

<th>Sr. No.</th>

<th>Name</th>

<th>Age</th>

</tr>

<td>1</td>

<td>Skillmaking</td>

<td>21</td>

</table>

</body>

</html>



Output of TABLE TAG in HTML:
table-tag-in-html

2 thoughts on “Table Tag in HTML | Attributes of Table Tag | Important Tags in HTML

Leave a Reply

Your email address will not be published. Required fields are marked *