表頭是指表格的第一行,其中的文字可以實現居中并且加粗顯示,這通過<th>標記實現。
基本語法
01 <table>
02 <tr>
03 <th>…</th>
04 …
05 </tr>
06 <tr>
07 <td>…</td>
08 …
09 </tr>
10 …
11 </table>
語法解釋
使用<th>標記替代td>標記,惟一的不同就是標記中的內容居中加粗顯示。
文件范例:10-17.htm
通過<th>標記實現表格的表頭。
01 <!-- ------------------------------ -->
02 <!-- 文件范例:10-17.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 <tr>
12 <th>軟件分類</th>
13 <th>軟件名稱</th>
14 </tr>
15 <tr>
16 <td>網頁圖像軟件</td><td>fireworks</td>
17 </tr>
18 <tr>
19 <td>網頁制作軟件</td><td>dreamweaver</td>
20 </tr>
21 <tr>
22 <td>網頁動畫軟件</td><td>flash</td>
23 </tr>
24 </table>
25 </body>
26 </html>
文件說明
第12行和第13行定義了表格的表頭。
新聞熱點
疑難解答