【发布时间】:2015-08-02 21:07:33
【问题描述】:
使用此代码,我可以选择前三个子元素:
span:nth-child(-n+3)
是否可以以相同的方式选择最后三个子元素?
这是 jsfiddle 中的一个示例:http://jsfiddle.net/nqhtzkaw/
更新:
这是答案:(感谢 Manoj Kumar)
/* First three items. */
span:nth-child(-n+3) {
}
/* Last three items. */
span:nth-last-child(-n+3) {
}
【问题讨论】:
标签: css