Ockonal Ockonal - 2 days ago 5
HTML Question

Html and tables

I have such table: http://jsfiddle.net/jDTTx/

I can't understand how to split cell with text 1 into 2 horizontal cells. Could you help me with this?


Answer

You will want to set the rowspan for all of the cells in the row above it to 2, and leave the row span for the two cells which you would like to appear split as 1.

See it in action: http://jsfiddle.net/jDTTx/6/

    <table border="1" style="border: 2px solid black; width: 50%; margin: 0 auto; text-align: center; font-weight: bold" cellpadding="0" cellspacing="0">
        <thead style="background-color: gray; color: white">
            <tr>
                <td>№</td>
                <td>Час</td>
                <td>АУД. 402</td>
                <td>АУД. 402<sup>A</sup></td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td rowspan="2">1</td>
                <td rowspan="2">8<sup><u>00</u></sup> - 9<sup><u>20</u></sup></td>
                <td>1a</td>
                <td rowspan="2"></td>
            </tr>
            <tr>
                <td>1b</td>
            </tr>
            <tr>
                <td>2</td>
                <td>9<sup><u>35</u></sup> - 10<sup><u>55</u></sup></td>
                <td>6</td>
                <td></td>
            </tr>
            <tr>
                <td>3</td>
                <td>11<sup><u>15</u></sup> - 12<sup><u>35</u></sup></td>
                <td></td>
                <td>7</td>
            </tr>
        </tbody>
    </table>​​​​​​​​​​​​​​​​​​
Comments