Have you tried setting the bottom margin to .row div
, i.e. to your "cells"?
When you work with actual HTML tables, you cannot set margins to rows, too - only to cells.
There is a pretty simple fix for this, the border-spacing
and border-collapse
CSS attributes work on display: table
.
You can use the following to get padding/margins in your cells.
.container {
width: 850px;
padding: 0;
display: table;
margin-left: auto;
margin-right: auto;
border-collapse: separate;
border-spacing: 15px;
}
.row {
display: table-row;
}
.home_1 {
width: 64px;
height: 64px;
padding-right: 20px;
margin-right: 10px;
display: table-cell;
}
.home_2 {
width: 350px;
height: 64px;
padding: 0px;
vertical-align: middle;
font-size: 150%;
display: table-cell;
}
.home_3 {
width: 64px;
height: 64px;
padding-right: 20px;
margin-right: 10px;
display: table-cell;
}
.home_4 {
width: 350px;
height: 64px;
padding: 0px;
vertical-align: middle;
font-size: 150%;
display: table-cell;
}
<div class="container">
<div class="row">
<div class="home_1">Foo</div>
<div class="home_2">Foo</div>
<div class="home_3">Foo</div>
<div class="home_4">Foo</div>
</div>
<div class="row">
<div class="home_1">Foo</div>
<div class="home_2">Foo</div>
</div>
</div>
Note that you have to have
border-collapse: separate;
Otherwise it will not work.
Works - Add Spacing To Table
#options table {
border-spacing: 8px;
}
adding a br tag between the divs worked. add br tag between two divs that are display:table-row in a parent with display:table
Add spacer span between two elements, then make it unvisible:
<img src="#" />
<span class="spacer">---</span>
<span>Text TEXT</span>
.spacer {
visibility: hidden
}
See the CSS 2.1 standard, section 17.5.3. When you use display:table-row
, the height of the DIV is solely determined by the height of the table-cell
elements in it. Thus, margin, padding, and height on those elements have no effect.
http://www.w3.org/TR/CSS2/tables.html