【发布时间】:2018-01-18 22:18:33
【问题描述】:
我正在开发一个 wordpress 主题,但我在帖子显示上遇到了一点问题,主题是在引导程序中开发的,所以我有一个用于帖子的类 col-md-6(2 列,共 3 列),并且 col-侧边栏的 md-4,在某些页面中,帖子显示完全正确,但在其他页面中,有一些空白。我以为是图像、摘录或标题的原因,但我试着把它们去掉,但也显示了一些页面中的白色间隙。这是截图:
这里是代码:
<div class="c-content-box c-size-md" >
<div class="container hidden-phone">
<div class="row">
<div class="c-content-blog-post-card-1-grid col-sm-12 col-md-12 col-xs-12">
<div class="row">
<div class="col-md-8">
<?php
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="col-md-6">
<div class="c-content-blog-post-card-1 c-option-2 c-bordered wow animate fadeInLeft" data-wow-delay="0.5s">
<div class="c-media img">
<div class="c-overlay-wrapper">
<div class="c-overlay-content">
<?php the_post_thumbnail( '', array( 'style' => 'width:100%;height:auto' ) ); ?>
</div>
</div>
</div>
<div class="c-body">
<div class="c-title c-font-bold c-font-uppercase" >
<a href="<?php echo the_permalink(); ?>"><?php the_title(); ?></a>
</div>
<div class="c-author">
<span class="c-font-uppercase"><?php the_time( 'M j Y' ); ?></span>
</div>
<div class="c-comments" style="text-align:center;">
<i class="icon-speech"></i> <?php comments_popup_link( '0 Comentarios', '1 Comentario', '% Comentarios' ); ?>
</div>
<div>
<?php the_excerpt(); ?>
</div>
</div>
</div>
</div>
<?php endwhile;
?>
<?php
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'goc' ),
'next_text' => __( 'Next page', 'goc' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'goc' ) . ' </span>',
) );
?>
</div>
<div class="col-md-4 ">
<div class="col-md-12 wow animate fadeInRight" data-wow-delay="1s">
<?php get_sidebar(); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main><!-- #main -->
</div><!-- #primary -->
<?php else : ?>
<?php endif; ?>
<?php
get_footer();
【问题讨论】:
-
你的边距如何在这个网格上工作,你只有边距右边还是两边都适用?您是否尝试过使用 :nth-child 运算符来降低第二篇文章的页边距?我能想到的唯一另一件事是第三个帖子向右移动,因为你在左边浮动,这迫使它进入可用空间。 Display flex 会修复它
标签: php css wordpress twitter-bootstrap loops