DIV CSS 佈局教程網

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

<tbody> 標記用於定義表格主體的樣式,也就是實際承載資料的那些列。

基本語法

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

語法解釋

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

檔案範例:10-45.htm

透過 <tbody> 標記設定表格主體樣式。

01 <!-- ------------------------------ -->
02 <!-- 檔案範例:10-45.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 </table>
28 </body>
29 </html>

檔案說明

第 16 行設定表格主體樣式,第 26 行以 </tbody> 收尾。對照第 11 行的 thead 背景色 #00ccff,主體改用 #00cccc,兩塊區域的分工一眼可辨。

這種寫法的好處是:樣式集中在結構標籤上,不必逐列重複宣告;日後調整配色只需改一處。

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