HTML标签

HTML <thead>标签

HTML <thead>标签作用

HTML <thead>元素用于定义HTML表的标题。 标签与和<tfoot>标签一起使用,它们定义HTML表中的表头,表主体和表尾。
标签必须是<table>元素,并且必须在任何,<tr>或<tfoot>元素之前使用它。
标签内应至少包含一行<tr>元素。

语法

<thead>
   <tr>
   </tr>
</thead>
以下是有关HTML 标签的一些规范
显示 内联
开始标签/结束标签 开始和结束标签
用法 表格标题

示例

<!DOCTYPE html>
<html>
<head>
<title>HTML thead Tag</title>
<style>
table{
border-collapse: collapse;
margin: 15px;}
thead{
background-color:#005cb9;}
tbody{
background-color: #d4caca;}
th,td{
padding: 12px;}
</style>
</head>
<body>
  <h2>Example of thead tag</h2>
  <table border="1">
  <caption>Population of India</caption>
   <thead>
   <tr>
   <th>Year</th>
   <th>Population</th>
   </tr>
   </thead>
<tbody>
<tr>
<td>2015</td>
<td>1,309,053,980</td>
</tr>
<tr>
<td>2016</td>
<td>1,324,171,354</td>
</tr>
<tr>
<td>2017</td>
<td>1,339,180,127</td>
</tr>
<tr>
<td>2018</td>
<td>1,354,051,854</td>
</tr>
</tbody>
</table>
</body>
</html>
输出:
 HTML thead标签

属性:

标签特定的属性:

属性 说明
align right
left
center
justify
char
它确定元素内内容的对齐方式。 (HTML5不支持)
char Character 它指定元素内的内容与字符的对齐方式。 (HTML5不支持)
charoff Number 它指定将从char属性指定的字符开始对齐的字符数。 (HTML5不支持)
valign top
middle
bottom
baseline
它确定元素内内容的垂直对齐方式。 (HTML5不支持)

全局属性:

标签在HTML中支持全局属性。

事件属性:

标签支持HTML中的事件属性。

支持浏览器

元素  chrome浏览器  ie浏览器  firefox浏览器 Opera浏览器  Safari浏览器
<thead>
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4