- Web design
- HTML5
- here
[HTML5] th tag --Create table items
You can create a table item heading with the th tag .
<th> Item heading </th>
In general, place tr and td tags under the table tag to create columns and items.
| 1 row 1 column heading | 1 row 2 column heading | 1 row 3 column heading |
|---|---|---|
| 2 rows and 1 column | 2 rows and 2 columns | 2 rows and 3 columns |
<style>
table {
border-collapse: collapse;
}
table th {
border: 1px solid #ddd;
padding: 7px;
background: #eee;
font-weight: bold;
}
table td {
border: 1px solid #ddd;
padding: 7px;
}
</style>
<table>
<tr>
<th> 1 row 1 column heading </th> <th> 1 row 2 column heading </th> <th> 1 row 3 column heading </th>
</tr>
<tr>
<td> 2 rows and 1 column </td> <td> 2 rows and 2 columns </td> <td> 2 rows and 3 columns </td>
</tr>
</table>
Please refer to the following articles for the specific method of creating the table.
HTML・CSS Writing 2022