相关疑难解决方法(0)

CSS动画,每个子元素都有延迟

我试图通过将动画应用于每个子元素来创建级联效果.我想知道是否有更好的方法来做到这一点:

.myClass img:nth-child(1){
    -webkit-animation: myAnimation 0.9s linear forwards;
}
.myClass img:nth-child(2){
    -webkit-animation: myAnimation 0.9s linear 0.1s forwards;
}
.myClass img:nth-child(3){
    -webkit-animation: myAnimation 0.9s linear 0.2s forwards;
}
.myClass img:nth-child(4){
    -webkit-animation: myAnimation 0.9s linear 0.3s forwards;
}
.myClass img:nth-child(5){
    -webkit-animation: myAnimation 0.9s linear 0.4s forwards;
}
Run Code Online (Sandbox Code Playgroud)

等等......所以基本上,我想为每个孩子制作一个动画,但是会有延迟.感谢您的任何意见!

另外:也许我没有正确解释我的担忧:无论我有多少孩子,这都是关于如何做到的.如何做到这一点,而不必写下每个孩子的属性...例如,当我不知道将有多少孩子.

css animation delay css-selectors css3

55
推荐指数
6
解决办法
7万
查看次数

标签 统计

animation ×1

css ×1

css-selectors ×1

css3 ×1

delay ×1