htmlHow to merge cells in a table
#In html, the colspan attribute is to merge columns, and the rowspan attribute is to merge rows. When merging rows , for example, rowspan="2", the next row tr will have one less column; when merging columns, colspan="2", the column of this row will have one less column.
Recommended learning: html tutorial
Code demonstration:
<table border="1" style={{margin:200}}> <tbody> <tr> <th colspan="2">我是占位符</th> <th colspan="2">我是占位符</th> </tr> <tr> <th rowspan="2">我是占位符</th> <th>我是占位符</th> <th>我是占位符</th> <th>我是占位符</th> </tr> <tr> <th>我是占位符</th> <th>我是占位符</th> <th>我是占位符</th> </tr> </tbody> </table>
Extended information:
rowspan specifies the number of rows that the header cell should span. Note: rowspan="0" tells the browser to make the cell span to the last row (thead, tbody, or tfoot) in the table component.
The above is the detailed content of How to merge cells in html table. For more information, please follow other related articles on the PHP Chinese website!