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

HTMLWeb DevelopmentFront End Technology

Use the rowspan attribute to set the number of rows a table cell should span. To merge cells in HTML, use the colspan and rowspan attribute. The rowspan attribute is for number of rows a cell should span, whereas the colspan attribute is for number of columns a 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>
raja
Published on 14-Mar-2018 10:25:17
Advertisements