Description 1 Description 1 Description 1

Stack only a single row in a responsive html table

35 views Asked by At

I want to stack only single row in a responsive html table using css.

<table>
    <tbody>
        <tr class="firstrow">
            <td colspan="2">Description 1</td>
            <td colspan="2">Content 1</td>
        </tr>
        <tr>
            <td>Description 2</td>
            <td>Content 2</td>
        </tr>
        <tr>
            <td>Description 3</td>
            <td>Content 3</td>
        </tr>
    </tbody>
</table>
table {
    width: 100%;
    border: 1px grey solid;
}
table td {
    border: 1px lime solid;
}
table .firstrow td {
    display: block;
}

But the stacked row has only the width of one of the following table rows.

enter image description here

If I apply the display: block to all tds in all table rows it spreads the whole width as expected.

enter image description here

How can I get the full width stacking for a single table row?

0

There are 0 answers