As horrible as the use of tables may be, after playing with all the proposed solutions I have found only one solution (using tables) that satisfies all my constraints. One day I hope to be able to translate Andy's code to a working solution with DIV's, right now I'm afraid I'm stuck with this. EDIT: For anyone who'd like to try, all source codes are available here.
To recap, my constraints were,
- Completely liquid layout: any cell follows the height of any other cell
- Spacing between the cells of 10px inside (but not outside)
- 3D border around the cells
- Working for all browsers that I have on my computer (Chrome, IE, Firefox)
Summarizing my solution, I've used empty spacer cells to implement the cell spacing since all other spacing methods known to me didn't satisfy all the constraints:
- CSS border-spacing adds a border around the whole table too that I don't want
- Selective cell borders limit my ability to add the 3D borders to my cells
Filling the spacer cells with nbsp's made them too high, so I chose to leave them empty and set the CSS empty-cells property to "show". The other option would have been to fill them up with 1x1 spacer GIF's but that is so 1990...
The code:
<html>
<head>
<style>
.outsidetable {
border-collapse: separate;
border-style: hidden;
empty-cells: show;
}
.spacercell {
width: 10px;
height: 10px;
border-style: none;
}
.contentcell {
border-style: outset;
border-color: yellow;
border-width: 2px;
background-color: #CCF;
}
</style>
</head>
<body>
<p>
<table class=outsidetable>
<tr>
<td class=contentcell>
Lorem ipsum dolor sit amet,
consectetur adipisicing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.
</td>
<td class=spacercell></td>
<td class=contentcell rowspan=3>
Lorem ipsum dolor sit amet,
consectetur adipisicing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.
</td>
</tr>
<tr>
<td class=spacercell colspan=3></td>
</tr>
<tr>
<td class=contentcell>
Lorem ipsum dolor sit amet,
consectetur adipisicing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.
</td>
<td class=spacercell></td>
</tr>
</table>
</p>
</body>
</html>