HTML - attributes - rowspan

revision:


Content

"rowspan" attribute : specifies the number of rows a table cell spans syntax some examples


"rowspan" attribute : specifies the number of rows a table cell spans

top

The rowspan attribute specifies the number of rows a cell should span.

The rowspan attribute can be used on the following elements:<td> and <th>.


syntax

top

<td rowspan="number"></td>

number: specifies the number of rows a cell should span. rowspan="0" tells the browser to span the cell to the last row of the table section (thead, tbody, or tfoot). Chrome, Firefox, and Opera 12 (and earlier versions) support rowspan="0".


some examples

top
Month Savings Savings for holiday!
January $100 $100
January $80
codes:
                    <table style="margin-left:3vw;">
                        <thead>
                        <tr>
                            <th>Month</th>
                            <th>Savings</th>
                            <th rowspan="3">Savings for holiday!</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>January</td>
                            <td>$100</td>
                            <td rowspan="0">$100</td>
                        </tr>
                        <tr>
                            <td>January</td>
                            <td>$80</td>
                        </tr>
                        </tbody>
                    </table>
                    <style>
                        table, th, td { border: 1px solid black;}
                    </style>
                
Name Age
Dennis 24
Hilde
codes:
                    <table style="margin-left:3vw;">
                        <tr>
                            <th>Name</th>
                            <th>Age</th>
                        </tr>
                        <tr>
                            <td>Dennis</td>
                            <td rowspan="2">24</td>
                        </tr>
                        <tr>
                            <td>Hilde</td>
                        </tr>
                    </table>