HTML table tags


HTML (Hypertext Markup Language) provides a set of tags that allow you to create tables on a web page. Tables are useful for organizing and presenting data in a structured format. The main tags involved in creating HTML tables are:

1.<table>: This tag is used to define the start and end of a table. Everything within these tags will be considered part of the table.

2.<tr>: This tag represents a table row. It is used to define a new row within the table. Each row contains one or more table cells.

3.<td>: This tag defines a table cell. It is used to create individual cells within a table row. Data, such as text or other HTML elements, is placed within the table cells.

4.<th>: This tag is used to define a table header cell. It is similar to <td>, but typically used to mark the header row or header cells within a table. The content within <th> is often displayed in bold or centered by default.


Here's an example of a simple HTML table structure that includes a header row, two data rows, and three columns:


html

Copy code

<table>

  <tr>

    <th>Header 1</th>

    <th>Header 2</th>

    <th>Header 3</th>

  </tr>

  <tr>

    <td>Data 1</td>

    <td>Data 2</td>

    <td>Data 3</td>

  </tr>

  <tr>

    <td>Data 4</td>

    <td>Data 5</td>

    <td>Data 6</td>

  </tr>

</table>

In this example, the table has three columns labeled "Header 1," "Header 2," and "Header 3." The data rows contain the corresponding data for each column. You can add more rows or columns by repeating the <tr>, <td>, or <th> tags as needed.

 These tags provide additional structural organization and semantic meaning to the table, but they are not mandatory for a basic table structure.

Comments

Popular Posts