Home > Web Front-end > HTML Tutorial > 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
Release: 2023-09-01 23:01:06
forward
1308 people have browsed it

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>
Copy after login

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!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template