css选择前几个元素,或者后几个元素

前5个元素&:nth-child(-n+5)

第5个元素后边所有&:nth-child(5+n)

.product-ad-item{

width: 184px;

height: 248px;

border-left: 1px solid #f2f2f2;

&:nth-child(-n+5){

border-bottom: 1px solid #f2f2f2;

}

css 选偶数元素 p:nth-child(2n)

css 选基数元素 p:nth-child(2n+1)

猜你喜欢

转载自blog.csdn.net/webZRH/article/details/83012190