rumpel rumpel - 4 months ago 8
CSS Question

stretching a table-cell to the width of the table

I'm trying to stretch a table-cell to the width of my table.
The width of the table depends on the width of my last table-row.

I couldn't find a way to solve it.
Have you got an idea or is it just impossible because of the behaviour of a table.
I created a fiddle where you can see what I mean.
My aim is to stretch the table-cell "TR1" to the width of tr3(sum of width from "TD1","TD","TD3").

This is how it should look like:


---------------
| TR1 |
---------------
| TR2 |
---------------
| TD1 |TD2| TD3 |
---------------


What I forgot to say is that unfortunately I cannot work with the style-attribute width
because I'm getting data from different databases.
I'm trying to sort them and put them into the table.

Thank you.

Answer

I'm not 100% on the browser restrictions of doing this, but why not put the maximum possible number of columns there could be in row 3?

Like this:

<tr><td colspan="20"></td>
<tr><td colspan="20"></td>
<tr><td></td><td></td><td></td></tr>