下午好球员,:nth-last-child(-n + 3)不适用于文章元素?
,因为它说,我想知道为什么:nth-last-child(-n+3) {}
我的文档标记里面的物品元素是不工作的称号?根据评论它应该工作,如下面的例子:http://jsfiddle.net/8PXXm/
当我通过我的布局内的标记,它不适合我。 我想选择连续的最后3个项目。
.post-entry:nth-last-child(n+3) { display: none; }
上面代码中选择所有的行项目,而不是最后3
HTML:
<article class="grid_4 post-entry">
<a href="#" title="">
<figure class="post-thumb">
<img src="../images/placehold.png" alt="Placehold">
<figcaption>
<img src="../images/cross.png" alt="Cross x">
</figcaption><!-- End figcaption.post-thumb -->
</figure><!-- End figure.post-thumb -->
</a>
</article><!-- End article.grid_4 post-entry -->
的jsfiddle:http://jsfiddle.net/4XP5W/11/
希望你能帮助我。 谢谢!
什么是您的HTML看起来像兄弟姐妹? –
'是否:nth-last-child(-n + 3)与article元素一起工作?' - 是的(参见[** jsfiddle **](http://jsfiddle.net/8PXXm/))。正如你可以在[** w3org Spec on nnth-last-child **](http://www.w3.org/TR/css3-selectors/#nth-last-child-pseudo)中看到的那样,它没有提到“article”元素被排除在功能之外。您的问题很可能是CSS命令本身与您拥有的标记结合使用。如果您发布相关标记,我们可以看看。 – Nope