How to set table title in html

青灯夜游
Release: 2021-10-11 14:50:56
Original
11807 people have browsed it

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.

How to set table title in html

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

How to set table title in html

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

How to set table title in html

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template