.list{ border-radius: 5px; padding: 10px; position: relative; } .list:nth-child(odd) { background-color: white; }
nth-child前面要不重复写.list,要怎么直接跟第一个css连起来
.list{ border-radius: 5px; padding: 10px; position: relative; } .list:nth-child(odd) { background-color: white; }
nth-child前面要不重复写.list,要怎么直接跟第一个css连起来
scss的写法是
.list{
border-radius: 5px;
padding: 10px;
position: relative;
&:nth-child(odd) {
background-color: white;
}
}