HTML – Table Colspan Rowspan

colspan  :         used to group columns in same row.

rowspan   :       used to group columns in next row.

<table>
            <caption>Life Expectancy By Current Age</caption>
            <tr>
                        <th colspan=”2″>65</th>
                        <th colspan=”2″>40</th>
                        <th colspan=”2″>20</th>
            </tr>
 
            <tr>
                        <th>Men</th>
                        <th>Women</th>
                        <th>Men</th>
                        <th>Women</th>
                        <th>Men</th>
                        <th>Women</th>
            </tr>
 
            <tr>
                        <td>82</td>
                        <td>85</td>
                        <td>78</td>
                        <td>82</td>
                        <td>77</td>
                        <td>81</td>
            </tr>
</table>
<table>
            <caption>Invoice</caption>
            <tr>
                        <th>Item / Desc.</th>
                        <th>Qty.</th>
                        <th>@</th>
                        <th>Price</th>
            </tr>
 
            <tr>
                        <td>Paperclips (Box)</td>
                        <td>100</td>
                        <td>1.15</td>
                        <td>115.00</td>
            </tr>
 
            <tr>
                        <td>Paper (Case)</td>
                        <td>10</td>
                        <td>45.99</td>
                        <td>459.90</td>
            </tr>
 
            <tr>
                        <td>Wastepaper Baskets</td>
                        <td>2</td>
                        <td>17.99</td>
                        <td>35.98</td>
            </tr>
 
            <tr>
                        <th colspan=”3″>Subtotal</th>
                        <td>610.88</td>
            </tr>
 
            <tr>
                        <th colspan=”2″>Tax</th>
                        <td>7%</td>
                        <td>42.76</td>
            </tr>
 
            <tr>
                        <th colspan=”3″>Total</th>
                        <td>653.64</td>
            </tr>
</table>
Scroll to Top