0

I'm using the Bootstrap framework and I'm displaying posts from a certain category in a thumbnail format.

The heights of the thumbnails are different. What I'd like to do is keep the heights different but still have the thumbnails stack beneath each other.

When I have more than 3 posts, it leaves a gap. Basically I'm looking to stack them in the same way as Pinterest.

This is what my code for the thumbnail looks like:

<div class="container-fluid">
        <?php 
            query_posts('cat=8');
                while(have_posts()) : the_post(); ?>


                        <div class="col-sm-6 col-md-4">
                            <div class="thumbnail">
                                <?php 
                                    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
                                        the_post_thumbnail( 'bones-thumb-300' );
                                    } 
                                ?>
                                <div class="caption">
                                    <h2><?php the_title(); ?></h2>
                                    <p class = "text-muted">Posted by <?php the_author(); ?> on <?php the_time('F jS, Y'); ?></p>
                                    <p><?php the_excerpt(); ?></p>
                                    <p><a href="<?php the_permalink(); ?>" class="btn btn-primary" role="button">Read More</a></p>
                                </div>
                            </div>
                        </div>


        <?php endwhile; wp_reset_query(); ?>

This is what it looks like now: my webpage

Any suggestions?

Thanks!

Siguza
  • 15,723
  • 6
  • 44
  • 66
Chris
  • 359
  • 1
  • 4
  • 17
  • Possible duplicate of: [Is it possible to create a pinterest-like layout with Bootstrap only?](http://stackoverflow.com/questions/12570559/is-it-possible-to-create-a-pinterest-like-layout-with-bootstrap-only) – user13286 Sep 28 '14 at 22:57

1 Answers1

0
  1. You are using the "Col" Method wrong. Check out Bootstrap for more Info about using Columns in a row (it should be maxium 12 for each row).

  2. You are looking for a Masonry Layout - check out this for more information and how you can do that. http://designshack.net/articles/css/masonry/

derdida
  • 14,120
  • 15
  • 78
  • 131