In HTML, you can use the caption tag to set the table title. The function of this tag is to define the title of the table. The syntax is "
Table title"; the caption tag needs to be placed in " ” tags are aligned.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
In HTML, you can use the
tag to set the table title.
The function of the tag is to define the title of the table.
tag needs to be placed in the "" tag pair, and must be placed directly after the tag. You can only define one title per table.
Example:
<table border="1">
<caption>人物信息</caption>
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
<tr>
<td>Peter</td>
<td>20</td>
</tr>
<tr>
<td>Lois</td>
<td>20</td>
</tr>
</table>
Copy after login
Usually this title will be centered above the table. However, the CSS properties "text-align" and "caption-side" can be used to set the alignment and display position of the title.
<table border="1">
<caption style="caption-side:bottom;">人物信息</caption>
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
<tr>
<td>Peter</td>
<td>20</td>
</tr>
<tr>
<td>Lois</td>
<td>20</td>
</tr>
</table>
Copy after login
Recommended tutorial: "html video tutorial"
The above is the detailed content of How to set table title in html. For more information, please follow other related articles on the PHP Chinese website!