Reputation: 14941
Ok following scenario in jsfiddle. The squares are coming from a CMS, i cannot hard code something. I need a clean way to always get 1 border thickness. At the moment the border thickness is sometimes 1 px and sometimes 2 px. The width of the container is given and it will always be 3 squares wide. So it will never have, say, 2 squares. Always $number_of_squares % 3 === 0 See screenshot
Is there a trick to it?
HTML:
<div class="container"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
CSS:
div{
display:inline-block;
height: 100px;
width: 100px;
vertical-align: top;
background-color: burlywood;
border: 1px solid #ccc;
}
.container{
width: 400px;
height: 400px;
background-color: white;
border: none;
}
See jsfiddle
Upvotes: 2
Views: 1338
Reputation: 4199
give container padding:1px 0 0 1px
;
& divs margin:-1px 0 0 -1px
;
Here is jsFiddle: DEMO
Upvotes: 8