In this article, you will learn how to create table rows & columns in HTML.
Creating Table Rows and Columns in HTML#
To create table rows and columns in HTML, you can use the <table>, <tr>, and <td> elements. These elements allow you to structure and organize data in a table format on a web page.
Example :
<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>
- The <table> element is used to create a table on the web page. It acts as the container for all the table content, including rows and columns.
- The <tr> element defines a table row. It is used to group together a set of table cells or data.
- The <th> element is used to define table headers. It represents the heading cells for each column. The content within <th> tags is typically displayed in bold and centered by default.
- The <td> element defines a table cell. It represents a single data entry within a table. It is used to define the content of each table data cell in the rows.
- Within the <table> element, you can have multiple <tr> elements, representing different rows in the table. Within each <tr>, you can have multiple <td> or <th> elements, representing the cells in that row. The number of cells in each row should match the number of headers or cells in the preceding rows.
Comments (0)