Udd*_*ers 2 html css css-selectors
我有一个新闻文章网格,我想它,所以网格中的最后两篇文章没有底部边框,但我的CSS last-child选择器似乎没有工作,最后一篇文章与右边的边框取消,然而最后一篇文章没有上课,是否有理由这样做?
这是我的代码和问题的小提琴.
如上面的@BoltClock所述,交换broder-bottomfor border-top和目标first-child.旧版浏览器不支持last-child:
JSFiddle:http://jsfiddle.net/HJE5h/2/
好吧,正如@BoltClock在下面的评论中提到的那样,问题并不完全在于last-child问题.但是,如果您border-top按照上面的建议使用然后定位select直接跟随的下一个元素,则first-child可以border-top从前两篇文章中删除.
section:first-child .snippet, section:first-child + section .snippet {
background:none;
border-top:none;
}
Run Code Online (Sandbox Code Playgroud)
JSFiddle:http://jsfiddle.net/HJE5h/5/