DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> HTML基礎知識 >> HTML和Xhtml
HTML 表格教學(46):用 tfoot 標記定義表尾樣式
編輯:HTML和Xhtml     

<tfoot> 標記用於定義表格表尾的樣式,常見用途是放置合計列或版權宣告。

基本語法

<tfoot align=value1 bgcolor=color_value valign=value2>

語法解釋

align 代表水平對齊:Left 靠左、Center 居中、Right 靠右。valign 代表垂直對齊:Top 靠上、Middle 居中、Bottom 靠下。

檔案範例:10-46.htm

透過 <tfoot> 標記設定表格表尾樣式。

01 <!-- ------------------------------ -->
02 <!-- 檔案範例:10-46.htm -->
03 <!-- 檔案說明:設定表格表尾樣式 -->
04 <!-- ------------------------------ -->
05 <html>
06 <head>
07 <title>設定表格表尾樣式</title>
08 </head>
09 <body>
10 <table border=3 width=400 height=100 bordercolor=#336699 align="Center">
11 <thead align=center bgcolor=#00ccff>
12 <tr>
13 <td colspan=2>網頁製作軟體</td>
14 </tr>
15 </thead>
16 <tbody align=Left bgcolor=#00cccc>
17 <tr>
18 <td>網頁圖像軟體</td><td>Fireworks</td>
19 </tr>
20 <tr>
21 <td>網頁製作軟體</td><td>Dreamweaver</td>
22 </tr>
23 <tr>
24 <td>網頁動畫軟體</td><td>Flash</td>
25 </tr>
26 </tbody>
27 <tfoot align=Right bgcolor=#00cc00>
28 <tr>
29 <td colspan=2>copyright 2004</td>
30 </tr>
31 </tfoot>
32 </table>
33 </body>
34 </html>

檔案說明

第 27 行設定表尾樣式,第 31 行以 </tfoot> 收尾。三個區域各用不同底色(#00ccff、#00cccc、#00cc00),thead/tbody/tfoot 的分工因此非常清楚。

一個實用細節:tfoot 允許寫在 tbody 之前。舊式 HTML 曾要求這個順序,好讓長表格的表尾能提前輸出;在 HTML5 中則建議把 tfoot 放在 tbody 之後,語意更直觀。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved