导航
×
   ❮   
HTML CSS JavaScript PHP Go Sass W3C Colors ECMS

HTML 参考手册

HTML 元素(功能排序) HTML 浏览器支持 HTML 属性 HTML 全局属性 HTML 事件 HTML 颜色 HTML 画布 HTML 音频/视频 HTML 字符集 HTML 文档类型 HTML URL 编码 HTML 语言代码 HTML 国家代码 HTTP 状态消息 HTTP 请求方法 PX-EM 转换 键盘快捷键

HTML 标签

<!--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <tfoot> 标签


实例

带有 thead、tbody 以及 tfoot 元素的 HTML 表格:

   <table>
            <thead>
                   <tr>
                <th>Month</th>
           <th>Savings</th>
                   </tr>
            </thead>
            <tbody>
         <tr>
           <td>January</td>
                     <td>$100</td>
         </tr>
         <tr>
           <td>February</td>
           <td>$80</td>
                   </tr>
            </tbody>
            <tfoot>
         <tr>
           <td>Sum</td>
           <td>$180</td>
         </tr>
            </tfoot>
     </table>
亲自试一试 »

下面有更多实例。


定义和用法

<tfoot> 标签定义表格的页脚(脚注或表注)。该标签用于组合 HTML 表格中的表注内容。

tfoot 元素应该与 theadtbody 元素结合起来使用。

thead 元素用于对 HTML 表格中的表头内容进行分组,而 tbody 元素用于对 HTML 表格中的主体内容进行分组。

注释: 如果您使用 thead、tfoot 以及 tbody 元素,您就必须使用全部的元素。它们的出现次序是:thead、tfoot、tbody,这样浏览器就可以在收到所有数据前呈现页脚了。您必须在 table 元素内部使用这些标签。

提示: 在默认情况下这些元素不会影响到表格的布局。不过,您可以使用 CSS 使这些元素改变表格的外观。

详细描述

thead、tfoot 以及 tbody 元素使您有能力对表格中的行进行分组。当您创建某个表格时,您也许希望拥有一个标题行,一些带有数据的行,以及位于底部的一个总计行。这种划分使浏览器有能力支持独立于表格标题和页脚的表格正文滚动。当长的表格被打印时,表格的表头和页脚可被打印在包含表格数据的每张页面上。


浏览器支持

元素          
<tfoot> Yes Yes Yes Yes Yes

全局属性

<tfoot> 标签支持 HTML 中的全局属性


事件属性

<tfoot> 标签支持 HTML 中的事件属性


更多实例

实例

使用CSS设置<thead>,<tbody>,<tfoot> 样式:

 <html>
<head>
<style>
thead {color: green;}
tbody {color: blue;}
  tfoot {color: red;}

table, th, td {
  border: 1px solid black;
  }
 </style>
</head>
<body>

<table>
 <thead>
   <tr>
     <th>Month</th>
     <th>Savings</th>
   </tr>
 </thead>
 <tbody>
   <tr>
     <td>January</td>
     <td>$100</td>
   </tr>
   <tr>
     <td>February</td>
     <td>$80</td>
   </tr>
 </tbody>
 <tfoot>
   <tr>
     <td>Sum</td>
     <td>$180</td>
   </tr>
 </tfoot>
</table>
亲自试一试 »

实例

如何对齐内容<tfoot> (使用 CSS):

   <table style="width:100%">
 <tr>
       <th>Month</th>
   <th>Savings</th>
 </tr>
     <tr>
   <td>January</td>
       <td>$100</td>
 </tr>
 <tr>
       <td>February</td>
   <td>$80</td>
 </tr>
     <tfoot style="text-align:center">
   <tr>
         <td>Sum</td>
     <td>$180</td>
       </tr>
 </tfoot> 
</table>
亲自试一试 »

实例

如何垂直对齐内容<tfoot> (使用 CSS):

   <table style="width:100%">
 <tr>
       <th>Month</th>
   <th>Savings</th>
 </tr>
     <tr>
   <td>January</td>
       <td>$100</td>
 </tr>
 <tr>
       <td>February</td>
   <td>$80</td>
 </tr>
     <tfoot style="vertical-align:bottom">
   <tr     style="height:100px">
     <td>Sum</td>
         <td>$180</td>
   </tr>
 </tfoot> 
</table>
亲自试一试 »

默认CSS设置

大多数浏览器将使用以下默认值显示 <tfoot> 元素:

tfoot {
  display: table-footer-group;
  vertical-align: middle;
      border-color: inherit;
} 

Copyright ©2020-2026 freew3c.com All Rights Reserved 提供的内容仅用于学习和测试,不保证内容的正确性。