html - 1px border around uneven amount of divs -
i'm trying solve issue has plagued me long. i'm attempting create following css:
https://gyazo.com/c8ae39ebc4795027ba7c1067a08d3420
there uneven amount of divs have styled so:
.box{ background-color: grey; float: left; width: 33.33%; border: 1px solid black; }
i attempting re-style divs in middle using nth-child it's making divs go weird orders , feels messy. there easier way?
codepen i'm trying do:
http://codepen.io/anon/pen/rrqnzm
thanks.
there no standard way this, simple trick use border
on right , bottom of .box
, top , left on wrapping element. way, give illusion borders collapse.
.box, .wrapper { border: 1px solid red; } .box { border-top: none; border-left: none; box-sizing: border-box; width: 33.33333333%; float: left; height: 45px; } .wrapper { border-right: none; border-bottom: none; overflow: hidden; }
<div class="wrapper"> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> </div>
Comments
Post a Comment