中的注释说明与JS的解决方案。因此,我将通过增加方式只能用动画和延迟做到在CSS完成此:
.item {
height: 50px;
width: 50px;
margin-top: 10px;
background: black;
animation: colorit 0.5s linear;
-webkit-animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
-ms-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
.item:nth-child(2) {
animation-delay: 0.5s;
}
.item:nth-child(3) {
animation-delay: 1s;
}
.item:nth-child(4) {
animation-delay: 1.5s;
}
@keyframes colorit {
from {
background-color: black;
}
to {
background-color: green;
}
}
@-webkit-keyframes colorit {
from {
background-color: black;
}
to {
background-color: green;
}
}
<div class="item">
</div>
<div class="item">
</div>
<div class="item">
</div>
<div class="item">
</div>
嗨。你试过什么了? –
要确认,您想要将绿色背景颜色应用到第一个项目div,然后将其移除并应用到第二个项目div,然后继续? –
[This might help](http://stackoverflow.com/questions/25351205/changing-color-of-multiple-divs-one-after-another) –