Creating Dynamic Tables with HTML

Shevaniett
featurepreneur
Published in
2 min readFeb 10, 2023

A table is a structured data set with rows and columns.

A table allows you to quickly and easily look up values that indicate some connection between different types of data.

Tables in HTML are created using the tag <table> between the body tag.

Syntax:

<table>
<!-- -->
</table>

Table row:

The <tr> tag defines a row in the table.

A <tr> tag can have one or more <th> or <td> tags.

Syntax:

<table>
<tr>
<th>
<!-- -->
</th>
</tr>
<tr>
<td>
<!-- -->
</td>
</tr>
</table>

Table Header:

The <th> tag defines the header cell in the HTML table.

This <th> contains the header information.

By default, the text within these tags is bold and centered.

Syntax:

<table>
<tr>
<th>
<!-- -->
</th>
</tr>
</table>

Example:

Output

Table Data:

The <td> tag defines a standard data cell in an HTML table.

<td> contains the data.

By default, the data within the <td> are left-aligned.

Output

--

--