Home  >  Article  >  Web Front-end  >  How to merge cells in html table

How to merge cells in html table

angryTom
angryTomOriginal
2020-02-11 17:38:0421429browse

How to merge cells in html table

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>

How to merge cells in html 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!

Statement:
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