Tables are an effective way to display data in a structured format on a web page. In HTML, tables are created using the <table>, <tr>, <th>, and <td> tags. Here’s how to create a basic table in HTML, along with an example:

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

In this example, the <table> tag defines the beginning and end of the table, while the <tr> tags define the beginning and end of each row. The <th> tags define table header cells, which are typically used to display column titles. The <td> tags define table data cells, which contain the actual data.

You can also use various attributes to customize the appearance of your table, such as colspan and rowspan, which allow you to span multiple rows or columns with a single cell, and border, which sets the thickness of the table border. Here’s an example that demonstrates some of these attributes:

<table border="1">
   <tr>
      <th colspan="2">Employee Information</th>
   </tr>
   <tr>
      <td rowspan="2">John Smith</td>
      <td>123 Main St.</td>
   </tr>
   <tr>
      <td>San Francisco, CA 94107</td>
   </tr>
   <tr>
      <td>Jane Doe</td>
      <td>456 Elm St.</td>
   </tr>
</table>

In this example, the border attribute sets the thickness of the table border, while the colspan and rowspan attributes are used to span multiple rows or columns with a single cell. Note that you can also use CSS to further customize the appearance of your table, including background color, font size, and text alignment.

Overall, tables are a powerful tool for organizing and presenting data on your website. By using the various HTML tags and attributes, you can create tables that are both functional and visually appealing.

Also check WHAT IS GIT ? It’s Easy If You Do It Smart

You can also visite the Git website (https://git-scm.com/)

Leave a Reply

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