首頁  >  文章  >  web前端  >  如何在HTML中設定表格儲存格應跨越的行數?

如何在HTML中設定表格儲存格應跨越的行數?

WBOY
WBOY轉載
2023-09-01 23:01:061226瀏覽

如何在HTML中設定表格儲存格應跨越的行數?

使用rowspan屬性設定表格單元格應跨越的行數。若要合併 HTML 中的單元格,請使用 colspanrowspan 屬性。 rowspan 屬性用於指定單元格應跨越的行數,而 colspan 屬性用於指定單元格應跨越的列數。

範例

<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
            border: 1px solid black;
            width: 100px;
            height: 50px;
         }
      </style>
   </head>

   <body>
      <h1>Heading</h1>
      <table>
         <tr>
            <th colspan = "2"></th>
            <th></th>
         </tr>
         <tr>
            <td></td>
            <td></td>
            <td rowspan = "2"></td>
         </tr>
         <tr>
            <td></td>
            <td></td>
         </tr>
      </table>
   </body>
</html>
#

以上是如何在HTML中設定表格儲存格應跨越的行數?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

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