遍历数组后添加样式,样式代码如下,效果如图:
.content .box:nth-child(n+1) {
background: linear-gradient(to bottom, #79E2FF, #66A8FF);
}
.content .box:nth-child(n+2) {
background: linear-gradient(to bottom, #FFD61C, #F4A80F);
}
.content .box:nth-child(n+3) {
background: linear-gradient(to bottom, #FF7984, #F42C5F);
}
如何让这三种样式循环出现?
3n+1
3n+2
3n