HTML Tables allow you to arrange data into rows and columns.
The <table>
tag defines an HTML table.
Each table row is defined with a <tr>
tag. Each table header is defined with a <th>
tag. Each table data/cell is defined with a <td>
tag.
By default, the text in <th>
elements are bold and centered.
By default, the text in <td>
elements are regular and left-aligned.
A simple HTML table is shown below:
<td>
elements are the data containers of the table. They can contain all sorts of HTML elements; text, images, lists, other tables, etc.
To make a cell span more than one column, use the colspan
attribute:
To make a cell span more than one row, use the rowspan
attribute: