Home  >  Article  >  Web Front-end  >  What is the function of caption attribute

What is the function of caption attribute

小老鼠
小老鼠Original
2023-11-23 11:54:251598browse

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!

Statement:
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