请帮我在这个jsfiddle上选择.url类的最后三个元素?
<a href="http://jsfiddle.net/eW6S5/135/">CSS</a>
答案 0 :(得分:1)
你可以这样做:
.projects:nth-last-of-type(1) .url , .projects:nth-last-of-type(2) .url , .projects:nth-last-of-type(3) .url{
background:blue;
}
示例:http://jsfiddle.net/cherniv/eW6S5/136/
甚至更有效和优雅(由强大的Itay):
.projects:nth-last-of-type(-n+3) .url