How's this for a work around (using an actual table)?
table {
border-collapse: collapse;
}
tr.row {
border-bottom: solid white 30px; /* change "white" to your background color */
}
It's not as dynamic, since you have to explicitly set the color of the border (unless there's a way around that too), but this is something I'm experimenting with on a project of my own.
Edit to include comments regarding transparent
:
tr.row {
border-bottom: 30px solid transparent;
}
Fiddle
.row-seperator{
border-top: solid transparent 50px;
}
<table>
<tr><td>Section 1</td></tr>
<tr><td>row1 1</td></tr>
<tr><td>row1 2</td></tr>
<tr>
<td class="row-seperator">Section 2</td>
</tr>
<tr><td>row2 1</td></tr>
<tr><td>row2 2</td></tr>
</table>
#Outline
Section 1
row1 1
row1 2
Section 2
row2 1
row2 2
this can be another solution
The closest thing I've seen would be to set border-spacing: 0 30px;
to the container div. However, this just leaves me with space on the upper edge of the table, which defeats the purpose, since you wanted margin-bottom.
If you want a specific margin e.g. 20px, you can put the table inside a div.
<div id="tableDiv">
<table>
<tr>
<th> test heading </th>
</tr>
<tr>
<td> test data </td>
</tr>
</table>
</div>
So the #tableDiv has a margin of 20px but the table itself has a width of 100%, forcing the table to be the full width except for the margin on either sides.
#tableDiv {
margin: 20px;
}
table {
width: 100%;
}