Maxim Lott Maxim Lott - 2 months ago 7
CSS Question

HTML table with second title halfway through column?

Is it possible to make a single table in html like the following? I realize one could make it two separate tables, but I don’t want to do that because I want the tables to line up perfectly (one directly underneath another.)

Is the below possible?

SINGLE TABLE:
Title 1
————————————————————————————————
| | |
| | |
| | |
| | |
| | |
————————————————————————————————
Title 2
————————————————————————————————
| | |
| | |
| | |
| | |
| | |
————————————————————————————————

Answer

This will do the trick..

    <table>
<!----><th>title 1</th>
        <tr>
            <td>row 1.1</td>
            <td>row 1.2</td>
        </tr>
        <tr>
            <td>row 2.1</td>
            <td>row 2.2</td>
        </tr>
<!----><th>title 2</th>
        <tr>
            <td>row 3.1</td>
            <td>row 3.2</td>
        </tr>
        <tr>
            <td>row 4.1</td>
            <td >row 4.2</td>
        </tr>
    </table>

Just add <th></th> where you want the Title Row..