Home >Web Front-end >HTML Tutorial >Usage of table in html
HTML table is a tool for organizing data into a grid-like structure, consisting of rows and columns. To create a table, you need to use the <table> tag, where <thead> and <tbody> represent the table header and table body respectively, <tr> represents the row, <th> and <td> represent the table header and table body respectively. body cell. Tables can set borders, spacing and width.
Using HTML tables
What is an HTML table?
HTML tables are used to organize data into a grid-like structure, and each cell is called a cell. Tables are made up of rows and columns, with rows being horizontal and columns being vertical.
How to create an HTML table
To create a table in HTML, you need to use the <table>
tag:
<code class="html"><table> <thead> <tr><th>列标题 1</th><th>列标题 2</th></tr> </thead> <tbody> <tr><td>单元格 1</td><td>单元格 2</td></tr> <tr><td>单元格 3</td><td>单元格 4</td></tr> </tbody> </table></code>
<thead>
and <tbody>
represent the table header and table body respectively. <tr>
represents row. <th>
represents the header cell. <td>
represents the table body cell. Table properties
Header and table body
Cell Properties
Example
The following is a simple table with borders and padding:
<code class="html"><table border="1" cellpadding="5"> <tr><th>姓名</th><th>年龄</th></tr> <tr><td>张三</td><td>20</td></tr> <tr><td>李四</td><td>25</td></tr> </table></code>
The above is the detailed content of Usage of table in html. For more information, please follow other related articles on the PHP Chinese website!