【发布时间】:2017-10-03 06:20:51
【问题描述】:
有一个循环,每行 3 个帖子。在每个单独的帖子周围制作边框时遇到问题。取而代之的是,它制作了一个边框,覆盖了顶部柱子,延伸到网格上的底部柱子。见screenshot
我尝试添加一个不同于此处使用的通用选择器的类名,但似乎不起作用。任何意见,将不胜感激。第一个使用 Wordpress 和 Bootstrap 的项目。使用 Sass 进行样式设置,因此使用 div 部分。提前致谢!
.col-sm-4 {
border: 1px solid gray;
}
<section id="blog-section">
<div class="container">
<div class="col-sm-12">
<h1>Blog Title</h1>
</div>
<div class="row">
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-4 text-center">
<?php $i = 1 ?>
<?php $posts = get_posts(array(
'post_type' => 'post',
'posts_per_page' => -1
));
foreach ($posts as $post) : start_wp(); ?>
<?php if ($i == 1): ?>
<a class="perm_link" href="<?php the_permalink(); ?>">
<h2><?php the_title(); ?></h2>
<div class="blog-image image-responsive"><?php the_post_thumbnail('thumbnail'); ?></div></a>
<p><?php the_excerpt(); ?></p>
<span class="shortlink">
<?php the_shortlink("Read More"); ?>
</span>
<?php endif; ?>
<?php if($i == 3){$i = 1;} else {$i++;} ?>
<?php endforeach; ?>
</div>
<div class="col-sm-4 text-center">
<?php $i = 1 ?>
<?php $posts = get_posts(array(
'post_type' => 'post',
'posts_per_page' => -1
));
foreach ($posts as $post) : start_wp(); ?>
<?php if ($i == 2): ?>
<h2><?php the_title(); ?></h2>
<div class="blog-image image-responsive"><?php the_post_thumbnail('thumbnail'); ?></div>
<p><?php the_excerpt(); ?></p>
<span class="shortlink">
<?php the_shortlink("Read More"); ?>
</span>
<?php endif; ?>
<?php if($i == 3){$i = 1;} else {$i++;} ?>
<?php endforeach; ?>
</div>
<div class="col-sm-4 text-center">
<?php $i = 1 ?>
<?php $posts = get_posts(array(
'post_type' => 'post',
'posts_per_page' => -1
));
foreach ($posts as $post) : start_wp(); ?>
<?php if ($i == 3): ?>
<h2><?php the_title(); ?></h2>
<div class="blog-image image-responsive"><?php the_post_thumbnail('thumbnail'); ?></div>
<p><?php the_excerpt(); ?></p>
<span class="shortlink">
<?php the_shortlink("Read More"); ?>
</span>
<?php endif; ?>
<?php if($i == 3){$i = 1;} else {$i++;} ?>
<?php endforeach; ?>
</div>
</div>
</div>
</section>
【问题讨论】:
标签: css wordpress twitter-bootstrap-3