我有一个如下所示的div结构,我只想在页面上定位最后一个.pcontain,这样我就可以删除边框了 - 我该怎么办呢?
<div class="container">
<div class="postcontainer">
<div class="latest-posts">
<div class="thumbnail"></div>
<div class="pcontain"></div>
<div class="more"></div>
</div>
</div>
<div class="postcontainer">
<div class="latest-posts">
<div class="thumbnail"></div>
<div class="pcontain"></div>
<div class="more"></div>
</div>
</div>
<div class="postcontainer">
<div class="latest-posts">
<div class="thumbnail"></div>
<div class="pcontain"></div>
<div class="more"></div>
</div>
</div>
<div class="postcontainer">
<div class="latest-posts">
<div class="thumbnail"></div>
<div class="pcontain"></div>
<div class="more"></div>
</div>
</div>
</div>
答案 0 :(得分:9)
答案 1 :(得分:2)
您可以使用last-child
伪类,如:
.postcontainer:last-child .pcontain {
color: darkolive;
}