Home >Web Front-end >HTML Tutorial >What is the function of caption attribute
In HTML, the caption attribute is an attribute used to specify the table title.
By using the caption attribute, you can specify a title for the table, which will be displayed at the top of the table. This title can be any text and can be formatted using CSS styles.
Here is an example of using the caption attribute:
html <table caption="这是一个表格标题"> <tr> <th>姓名</th> <th>年龄</th> </tr> <tr> <td>张三</td> <td>25</td> </tr> <tr> <td>李四</td> <td>30</td> </tr> </table>
In the above example, the caption Property specifies a table title that will be displayed at the top of the table. This title can be any text and can be formatted using CSS styles.
The above is the detailed content of What is the function of caption attribute. For more information, please follow other related articles on the PHP Chinese website!