valleyheart
valleyheart

Reputation: 29

Table with 3 headers but two columns

Is there a way to do this type of table using HTML / CSS?

Header1 | Header2 | Header 3
--------+---------+----------
0       | 1  asdasdasdasd 7
2       | 5  asdasdasdasd 3
9       | 7  asdasdasdasd 2

Upvotes: 2

Views: 587

Answers (2)

GoMega54
GoMega54

Reputation: 148

By using colspan you can make cells span multiple columns.

<table>
    <tr>
        <th>Header 1</th>
        <th>Header 2</th>
        <th>Header 3</th>
    </tr>
    <tr>
        <td>0</td>
        <td colspan="2">1 asdasdasdasd 7</td>
    </tr>
    <tr>
        <td>2</td>
        <td colspan="2">5 asdasdasdasd 3</td>
    </tr>
    <tr>
        <td>9</td>
        <td colspan="2">7 asdasdasdasd 2</td>
    </tr>
</table>

Upvotes: 2

c-smile
c-smile

Reputation: 27470

If you have <table> markup then <td colspan=2> will help you. If you want this with <div>s and so with pure CSS then you will need so called grid systems

Upvotes: 2

Related Questions