css选择器
//选中除了最后一个div
div:not(:last-child) {
}
//选中除了第一个div
div:not(:first-child) {
}
//选中前两个
div:nth-child(-n+2) {
}
//选中除了前两个
div:nth-child(n+2) {
}
使用公式 (an + b)。描述:表示周期的长度,n 是计数器(从 0 开始),b 是偏移值(整体偏移)。
p:nth-child(3n+0)
{
background:#ff0000;
}//选中除了最后一个div
div:not(:last-child) {
}
//选中除了第一个div
div:not(:first-child) {
}
//选中前两个
div:nth-child(-n+2) {
}
//选中除了前两个
div:nth-child(n+2) {
}
使用公式 (an + b)。描述:表示周期的长度,n 是计数器(从 0 开始),b 是偏移值(整体偏移)。
p:nth-child(3n+0)
{
background:#ff0000;
}