首頁  >  文章  >  web前端  >  在HTML中如何建立表頭?

在HTML中如何建立表頭?

WBOY
WBOY轉載
2023-09-07 18:29:041461瀏覽

在HTML中如何建立表頭?

使用HTML中的標籤來建立表格頭。 HTML中的標籤用於在表格中新增表格頭。 thead標籤與tbody標籤和tfoot標籤一起用於確定表格的每個部分(表頭、表尾、表體)。

HTML中的標籤也支援下列附加屬性:

valign#top

##值

描述

#align

right

left

center

justify

char

已棄用− 可視對齊。

char

#character

#已棄用− 指定要對齊文字的字元。當align = "char"時使用。

charoff

#pixels or %

##已棄用− 指定與char屬性指定的第一個字元的對齊偏移量(以像素或百分比值表示)。當align = "char"時使用。

middle

bottom

baseline

已棄用− 垂直對齊。

範例

您可以嘗試執行以下程式碼來學習如何在HTML中實作

標籤:

<!DOCTYPE html>
<html>
   <head>
      <title>HTML thead Tag</title>
   </head>
   <body>
      <table style = "width:100%" border = "1">
         <thead>
            <tr>
               <td colspan = "4">This is the head of the table</td>
            </tr>
         </thead>
         <tfoot>
            <tr>
               <td colspan = "4">This is the foot of the table</td>
            </tr>
         </tfoot>
         <tbody>
            <tr>
               <td>Cell 1</td>
               <td>Cell 2</td>
               <td>Cell 3</td>
               <td>Cell 4</td>
            </tr>
            <tr>
            ...more rows here containing four cells...
            </tr>
         </tbody>
     
         <tbody>
            <tr>
               <td>Cell 1</td>
               <td>Cell 2</td>
               <td>Cell 3</td>
               <td>Cell 4</td>
            </tr>
            <tr>
            ...more rows here containing four cells...
            </tr>
         </tbody>
      </table>
   </body>
</html>

以上是在HTML中如何建立表頭?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除