html table cell width for different rows [duplicate]

One solution would be to divide your table into 20 columns of 5% width each, then use colspan on each real column to get the desired width, like this:

<html>
<body bgcolor="#14B3D9">
<table width="100%" border="1" bgcolor="#ffffff">
    <colgroup>
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
        <col width="5%"><col width="5%">
    </colgroup>
    <tr>
        <td colspan=5>25</td>
        <td colspan=10>50</td>
        <td colspan=5>25</td>
    </tr>
    <tr>
        <td colspan=10>50</td>
        <td colspan=6>30</td>
        <td colspan=4>20</td>
    </tr>
</table>
</body>
</html>

JSFIDDLE

Leave a Comment