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:

enter image description here

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..

masonry-style layout css

applied bootstrap list-group this..

http://bootply.com/85737

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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -