css - Bootstrap - 高度不同时堆叠缩略图

标签 css twitter-bootstrap thumbnails

我正在使用 Bootstrap 框架并以缩略图格式显示来自特定类别的帖子。

缩略图的高度不同。我想要做的是保持不同的高度,但仍然让缩略图堆叠在彼此之下。

当我有超过 3 个帖子时,它会留下空白。基本上,我希望以与 Pinterest 相同的方式堆叠它们。

这是我的缩略图代码:

<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(); ?>

现在是这样的: my webpage

有什么建议吗?

谢谢!

最佳答案

  1. 您使用的“Col”方法有误。查看 Bootstrap,了解有关在一行中使用列的更多信息(每行最多应有 12 个列)。

  2. 您正在寻找 Masonry Layout - 查看此以获取更多信息以及如何做到这一点。 http://designshack.net/articles/css/masonry/

关于css - Bootstrap - 高度不同时堆叠缩略图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26090441/

相关文章:

html - 生成动态径向背景

html - 渲染 svg 与图像

javascript - angular-ui bootstrap datepicker(如何在弹出窗口中仅禁用今天按钮)

javascript - bootstrap col push pull 使用移动版

swift - 快速在 UICollectionView 上添加 Youtube 缩略图

jquery - JQM Textarea的速度

html - 减小窗口大小时,Div 背景颜色未填充文本高度的 100%

video - 改进了从视频中提取缩略图

c++ - 在 TIFF 中创建一个带有缩略图的子 IFD (libtiff)

css - Wordpress:导航边框底部