以下的代码可以用LESS重写吗?
#bg-slider{
li:nth-child(1){
background:url('../images/bg1.jpg');
}
li:nth-child(2){
background:url('../images/bg2.jpg');
}
li:nth-child(3){
background:url('../images/bg3.jpg');
}
}
我尝试过:
.bg-image (@slide) {
background:url('../images/bg@{slide}.jpg');
}
#bg-slider{
li:nth-child(n){
.bg-image(n);
}
}
但这只会给所有的li都提供'../images/bgn.jpg'。
.applyToCol(@colNum...:nth-child(0n+@{colNum})
- Zachary Ryan Smith