我想禁用while循环中最后一个元素的边界底部,但它不起作用。。。这是代码:
<div class="col-sm-4">
<?php if ( $the_query->have_posts() ): ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h2 class="special-project-title"><?php the_title()?></h2> <br/>
<div class="post-meta special-project-meta"><?php mida_post_meta()?></div><br/>
<a class="more-link spaciel-project-more" href="<?php echo the_permalink() ?>"><?php echo __('Read More', 'mida')?></a><br/>
<?php endwhile; endif;?>
<?php wp_reset_query(); ?>
</div>
"spaciel project more"有边界底部,但我希望最后一个没有边界底部。。我想不通。。
CSS:
.spaciel-project-more{
border-bottom: 1px solid black;
margin-top: -15px;
margin-bottom: -15px;
padding-bottom: 15px;
}
.spaciel-project-more:last-child{
border-bottom:none;
}
提前感谢!
它不是:last-child
,因为之后还有其他内容。您可以使用:last-of-type
:
.spaciel-project-more:last-of-type {
border-bottom: 0
}
演示:JSFiddle
在css中的样式中使用此选项可能有助于
.spaciel-project-more:last-child{
border-bottom:0px;
}