html - Bootstrap broken grid in gallery -


i trying create video gallery shows different number of images per row based on screen size, using bootstrap.

i started blog post: http://michaelsoriano.com/create-a-responsive-photo-gallery-with-bootstrap-framework/

my end result here: http://jsfiddle.net/mk2r974o/

<div class="container">    <h2>video gallery</h2>   <ul class="gallery row">      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=0gqk3ivfk0a" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/0gqk3ivfk0a/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">integration</span>          <figcaption class="figure-caption">           streamline integration backend systems using mobilefirst         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=ntt25h6paxi" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/ntt25h6paxi/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">development</span>          <span class="label label-info">android</span>          <figcaption class="figure-caption">           creating windows native c# app connecting mobilefirst         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=fmtmoupbhni" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/fmtmoupbhni/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">integration</span>          <figcaption class="figure-caption">           continuous integration         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=wrcmljuimuk" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/wrcmljuimuk/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">integration</span>          <span class="label label-info">android</span>          <figcaption class="figure-caption">           ibm mobilefirst platform foundation android proguard         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=euuvr9dat5m" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/euuvr9dat5m/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">analytics</span>          <figcaption class="figure-caption">           operational analytics lob         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=eqdprf-9smc" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/eqdprf-9smc/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">analytics</span>          <figcaption class="figure-caption">           operational analytics console         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=xtlji4zemzq" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/xtlji4zemzq/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">analytics</span>          <figcaption class="figure-caption">           operational analytics custom charts         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=ckm5480-6wi" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/ckm5480-6wi/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">java</span>          <span class="label label-info">adapters</span>          <figcaption class="figure-caption">           getting familiar java adapters - part 1         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=z2qui33_a5k" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/z2qui33_a5k/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">java</span>          <span class="label label-info">adapter</span>          <figcaption class="figure-caption">           getting familiar java adapters - part 2         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=uyegupyszj4" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/uyegupyszj4/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">oauth</span>          <span class="label label-info">security</span>          <figcaption class="figure-caption">           oauth security - part 1         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=eefbcptxlfu" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/eefbcptxlfu/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">oauth</span>          <span class="label label-info">security</span>          <figcaption class="figure-caption">           oauth security - part 2         </figcaption>       </figure>     </li>      <li class="col-lg-2 col-md-2 col-sm-3 col-xs-4">       <figure>         <a href="//www.youtube.com/watch?v=tfvogrmc4ss" data-toggle="lightbox" data-width="960" data-gallery="youtubevideos">           <img src="//img.youtube.com/vi/tfvogrmc4ss/hqdefault.jpg" class="thumbnail img-responsive">         </a>          <span class="label label-info">cli</span>          <span class="label label-info">integration</span>          <figcaption class="figure-caption">           integrating ibm mobilefirst cli grunt         </figcaption>       </figure>     </li>    </ul> </div> 

sometimes looks fine:

enter image description here

sometimes sticks 1 of thumbnails right:

enter image description here

try setting fixed height col-*-* classes instead of applying margin-bottom them. can write like:

.gallery li {   list-style: none;   //margin-bottom: 25px; not needed   height: 250px; } 

jsfiddle: http://jsfiddle.net/mk2r974o/6/

hope helps.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -