How to use caption tag

不言
Release: 2019-02-12 13:26:28
Original
5400 people have browsed it

Thecaption tag is used to add a title to an HTML table. The caption must appear immediately after the table in the HTML document. It can be positioned intuitively at the bottom of the table using CSS. Let’s take a look. Specific usage of caption tag.

How to use caption tag

The caption element defines the table title, but only one title can be defined for each table. Usually this title will be centered above the table. (Reference address: HTML table)

Let’s look at a specific example

The code is as follows

<!DOCTYPE How to use caption tag>
<How to use caption tag>
<head>
    <title></title>
    <meta charset="utf-8">
</head>
<body>
<table border="1" cellspacing="0">
    <caption>最喜欢的颜色</caption>
    <tr>
        <th>名字</th>
        <th>喜欢的颜色</th>
    </tr>
    <tr>
        <td>Tom</td>
        <td>蓝色</td>
    </tr>
     <tr>
        <td>Jerry</td>
        <td>红色</td>
    </tr>
     <tr>
        <td>Marry</td>
        <td>粉色</td>
    </tr>
     <tr>
        <td>Cindy</td>
        <td>黄色</td>
    </tr>
</table>
</body>
</How to use caption tag>
Copy after login

The effect is as follows: The title is in the middle of the table.

How to use caption tag

This article ends here. For more exciting content about the front-end, you can pay attention to the relevant column tutorials on the PHP Chinese website! ! !

The above is the detailed content of How to use caption tag. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!