HTML <table> Tag

When do we use the <table> tag in HTML?

We use the <table> tag in HTML for the creation of a table.

The <table> tag comes in pairs. It means we must write the whole content between <table> and </table> tag.

The <table> tag contains the follow tags:

The <table> tag contains one or more <tr>, <th>, and <td> elements.

Let's see an example.

<!DOCTYPE html>
<html>
   <head>
      <title>Title of the document</title>
   </head>
   <body>
      <table  border="1" style="border-collapse:collapse;">
         <tr>
            <th>Month</th>
            <th>Date</th>
         </tr>
         <tr>
            <td>Jun</td>
            <td>10.06.2014</td>
         </tr>
         <tr>
            <td>July</td>
            <td>15.07.2014</td>
         </tr>
      </table>
   </body>
</html>

The <tr> tag is used for creation of table rows.

The <th> tag is used for creation of the contents of table header cells.

The <td> tag is used for creation of the contents of table data cells.

The <table> tag has attributes, which are not supported in HTML5.

All the changes we want to do with the table, we should do with CSS.

The <table> tag also contains the follow tags:

The <table> tag also supports the Global Attributes .