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

Table Tag in HTML | Attributes of Table Tag

In this article, we will talk to you about table tag of HTML. If you are a beginner then you should definitely learn about table tag in HTML. In this article, you can get information about the attributes of table tag. We collect this all information from self-practical work. And we also check the articles of W3SCHOOL. W3school is a very good website to learn about HTML.




About Table Tag:

<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

Conclusion:

Now finally, I hope that you have good knowledge about table tag and the attributes of table tag after reading this article. In this article, we got information about the table tag and the attributes of table tag. Thank you for read this article till the end. If you have any question regarding this article then you should comment down below at the comment section. And you should share your thoughts regarding this article.  You should also read our more article regarding web development. I give you some links below, hope you will also love those articles.

List Tag in HTML

Form Tag in HTML

9 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 *