css - Wrong position for col-md-4 in flexible layout with bootstrap -


having difficulties in resolving issue (see screenshot). basically, fact first cell in second line has bigger height 7th cell not place ... workarounds? there doing wrong?

code extract

<div class="row">    <!-- contribution -->   <div class="col-xs-6 col-md-4" style="border:1px solid red;">      <!-- pic -->     <div class="col-xs-4 col-md-3">       ...     </div>      <!-- payment -->     <div class="col-xs-8 col-md-9">       <div class="name">anonymous</div>       <div class="contributed">contributed</div>     </div>    </div>   <!-- end contribution --> </div> 

it goes same contributions. can't use row div each line on small screens rows have 2 contributions instead of 3. using col-xs-6 col-md-4 without rows allows me have flexible layout.

enter image description here

to build on head in cloud's answer, want use clearfix class after every 2nd div (visible-xs visible-sm) xs , small screens, , clearfix class after every 3rd div (hidden-xs hidden-sm) medium , larger screens. reproduce example above:

<div class="row">     <div class="col-xs-6 col-md-4" style="border:1px solid red;">          <!-- inner content -->     </div>     <div class="col-xs-6 col-md-4" style="border:1px solid red;">          <!-- inner content -->     </div>     <div class="clearfix visible-xs visible-sm"></div>     <div class="col-xs-6 col-md-4" style="border:1px solid red;">          <!-- inner content -->     </div>     <div class="clearfix hidden-xs hidden-sm"></div>     <div class="col-xs-6 col-md-4" style="border:1px solid red;">          <!-- inner content -->     </div>     <div class="clearfix visible-xs visible-sm"></div>     <div class="col-xs-6 col-md-4" style="border:1px solid red;">          <!-- inner content -->     </div>     <div class="clearfix visible-xs visible-sm"></div>     <div class="col-xs-6 col-md-4" style="border:1px solid red;">          <!-- inner content -->     </div>     <div class="clearfix"></div> <!-- 1 needed screen sizes, use clearfix class --> </div> 

another option, if work type of content you're using, set min-height on elements. estimate, if set min-height value larger largest element, of divs same height, stack correctly , wouldn't have worry clearfix. isn't ideal, because if ever change content, you'd have make sure still falls within min-height value.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -