css3 - Bootstrap: how to stack divs of different heights? -
this question bit similar this one, want know if there pure css solution compatible bootstrap.
basically, have following layout:
this html of page:
<div class="menu row"> <div class="menu-category list-group col-lg-3 col-md-4 col-sm-6 col-xs-12"> <div class="menu-category-name list-group-item active">category</div><a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> </div> <div class="menu-category list-group col-lg-3 col-md-4 col-sm-6 col-xs-12"> <div class="menu-category-name list-group-item active">category</div><a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> </div> <div class="menu-category list-group col-lg-3 col-md-4 col-sm-6 col-xs-12"> <div class="menu-category-name list-group-item active">category</div><a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> </div> <div class="menu-category list-group col-lg-3 col-md-4 col-sm-6 col-xs-12"> <div class="menu-category-name list-group-item active">category</div><a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> </div> <div class="menu-category list-group col-lg-3 col-md-4 col-sm-6 col-xs-12"> <div class="menu-category-name list-group-item active">category</div><a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> <a href="#" class="menu-item list-group-item">lorem ipsum.<span class="badge">€ 0.00</span></a> </div> </div>
the problem is, can see, row system of bootstrap bit inconvenient here. want these categories stack in optimal way. question is: how can css? masonry plugin seems excellent keep plan b.
thanks!
take @ these examples..
applied bootstrap list-group
this..
however, need remove bootstrap col-*
classes markup since use floats mess masonry layout. use *-column-width
property change width of panels. so, it's possible pure css, not cross-browser compatible still may want use masonry plugin fallback.
if you're looking ensure columns wrap every x columns, use bootstrap responsive resets, or clearfix solution media queries this: http://www.codeply.com/go/jxuoghhker
more on solving different heights issue
update bootstrap 4 include css column layout masonry option.
Comments
Post a Comment