Creating Tables

Tables are used to display tabular data in HTML. They consist of rows and columns, and each cell in a table can contain text, images, or other HTML elements.

The <table> element is used to define a table. The <tr> element is used to define a row, and the <td> element is used to define a cell. The <th> element is used to define a header cell.

Here is an example of a simple table:

<table>
  <tr>
    <th>Country</th>
    <th>Capital</th>
  </tr>
  <tr>
    <td>United States</td>
    <td>Washington, D.C.</td>
  </tr>
  <tr>
    <td>Canada</td>
    <td>Ottawa</td>
  </tr>
  <tr>
    <td>Mexico</td>
    <td>Mexico City</td>
  </tr>
</table>

This table defines a table with three rows and two columns. The first column is the country name, and the second column is the capital city.

Task

Create a 2 rows, 3 columns HTML table after the Experience heading with the first row having 3 empty th elements and the second row with empty 3 td elements. Run the code to see the results and experiment with the code to get used to it.

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT