Spacing in <li> tags with table mapping table
I have four tags li, and they all contain images in it. Now I want to show the images vertically, and for this I used display: table-cellfor everyone li, and in the image I used vertical alignment in the middle. But the margin does not work when I try to set the interval between li.
Here is the JSFiddle
HTML
<div class="achievements">
<h2>Our <span>Achievements</span></h2>
<ul>
<li>
<img src="images/award-1.png">
</li>
<li>
<img src="images/award-2.png">
</li>
<li>
<img src="images/award-3.png">
</li>
<li>
<img src="images/award-4.png">
</li>
</ul>
</div>
CSS
.achievements ul {
margin: 0;
padding: 0;
list-style: none;
}
.achievements ul li {
min-width: 304px;
min-height: 208px;
vertical-align: middle;
display: table-cell;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-shadow: 0px 0px 3px #aaa;
color: #000;
margin-right: 14px;
padding-bottom: 32px;
max-width: 303px;
background: #fff;
font-family:'gafata';
padding-top: 32px;
line-height: 23px;
text-align:center;
}
.achievements ul li img {
vertical-align: middle;
}
+4
1 answer
Use border-spacingto add distance between cells.
For this to affect the table, the value border-collapsemust be separate(default value) as opposed collapse.
.achievements ul {
margin: 0;
padding: 0;
list-style: none;
display:table;
border-spacing: 10px;
border-collapse: separate;
}
, margin:0 auto. ()
+8