Home  >  Article  >  Web Front-end  >  How to set the number of rows a table cell should span in HTML?

How to set the number of rows a table cell should span in HTML?

WBOY
WBOYforward
2023-09-01 23:01:061227browse

How to set the number of rows a table cell should span in HTML?

Use the rowspan property to set the number of rows a table cell should span. To merge cells in HTML, use the colspan and rowspan attributes. The rowspan property specifies the number of rows the cell should span, while the colspan property specifies the number of columns the cell should span.

Example

<!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>

The above is the detailed content of How to set the number of rows a table cell should span in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete