css - Bootstrap column align to previous item in column -
i've tried resolve problem while need stackoverflow.. have template 2 columns (with bootstrap grid system) : http://snag.gy/vh9do.jpg
and : http://snag.gy/cyilo.jpg
my html looks moment :
<div class="container-fluid"> <div class="row"> <div class="post-container column-md-6" id="post-1"> content... </div> <div class="post-container column-md-6" id="post-2"> content... </div> </div> <div class="row"> <div class="post-container column-md-6" id="post-3"> content... </div> <div class="post-container column-md-6" id="post-14"> content... </div> </div> [...] </div>
do have idea how ? (without breaking post order in page, because 1 column in portrait orientation)
you wont able html, need add js , there many plugins (one example: http://www.akshitsethi.me/pinterest-like-grid-layout-using-jquery/)
another option (if don`t need ie support - 10% of users):
css3 collumn. easy , clean:
check out fiddle > http://jsfiddle.net/luckmattos/aexxp/1/ or www.w3schools.com "css3_multiple_columns" or...
html
<div> <div class="item1">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <div class="item2">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <div class="item3">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <div class="item1">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <div class="item3">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <div class="item2">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <div class="item1">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <div class="item3">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> <div class="item2">lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</div> </div>
css
div { width:500px; padding:10px; background:#ccc; /* number of cols */ -moz-column-count:2; /* firefox */ -webkit-column-count:2; /* safari , chrome */ column-count:2; /* distance between cols */ -moz-column-gap:10px; /* firefox */ -webkit-column-gap:10px; /* safari , chrome */ column-gap:10px; } .item1 { background:#f00; height:100px; padding: 3px; margin:10px; display:inline-block; } .item2 { background:#0f0; height:150px; padding: 3px; margin:10px; display:inline-block; } .item3 { background:#00f; height:100px; padding: 3px; margin:10px; display:inline-block; }
Comments
Post a Comment