HTML Table Tag 

The HTML <table> tag is used to create a table on a web page. Tables are commonly used to organize and display data in a structured format. The <table> tag is used in conjunction with other tags such as <tr> (table row), <th> (table header), and <td> (table data) to define the structure and content of the table.

Here is an example of a basic table structure:

<table>
  <tr>
    <th>Column 1</th>
    <th>Column 2</th>
    <th>Column 3</th>
  </tr>
  <tr>
    <td>Row 1, Column 1</td>
    <td>Row 1, Column 2</td>
    <td>Row 1, Column 3</td>
  </tr>
  <tr>
    <td>Row 2, Column 1</td>
    <td>Row 2, Column 2</td>
    <td>Row 2, Column 3</td>
  </tr>
</table>

In this example, the <table> tag is used to create a table. The <tr> tags define the rows of the table, while the <th> and <td> tags define the header and data cells of each row, respectively.

The first row of the table is typically used to define the header, which provides a label for each column. The remaining rows of the table contain the data.

Here are some additional attributes that can be used with the <table> tag:

  • border: This attribute specifies the width of the border around the table.
  • width: This attribute specifies the width of the table.
  • align: This attribute specifies the alignment of the table with respect to the surrounding content.
  • bgcolor: This attribute specifies the background color of the table.

Here is an example of how to use some of these attributes:

<table border="1" width="100%" align="center" bgcolor="#f0f0f0">
  <tr>
    <th>Column 1</th>
    <th>Column 2</th>
    <th>Column 3</th>
  </tr>
  <tr>
    <td>Row 1, Column 1</td>
    <td>Row 1, Column 2</td>
    <td>Row 1, Column 3</td>
  </tr>
  <tr>
    <td>Row 2, Column 1</td>
    <td>Row 2, Column 2</td>
    <td>Row 2, Column 3</td>
  </tr>
</table>

In this example, the border attribute is set to 1 to add a border around the table. The width attribute is set to 100% to make the table fill the entire width of the screen, and the align attribute is set to center to horizontally center the table. The bgcolor attribute is set to #f0f0f0 to give the table a light gray background color.

Tables are a useful way to organize and display data on a web page. By using the various attributes available, you can customize the appearance of the table to fit your needs.

Wordpress Social Share Plugin powered by Ultimatelysocial
Wordpress Social Share Plugin powered by Ultimatelysocial