【发布时间】:2019-03-21 02:56:58
【问题描述】:
我有以下关键帧,我想通过这些关键帧来制作窗口徽标的动画:
.box {
height: 40px;
width: 40px;
float: left;
}
#box1 {
#background-color: red;
animation: box1 4s 1s infinite;
}
#box2 {
#background-color: lightgreen;
animation: box2 4s 1s infinite;
}
@keyframes box2 {
0% {
background-color: #1b2028;
}
25% {
background-color: #1b2028;
}
50% {
background-color: #1b2028;
}
75% {
background-color: lightgreen;
100% {
background-color: #1b2028;
}
}
@keyframes box1 {
0% {
background-color: red;
}
25% {
background-color: red;
}
50% {
background-color: red;
}
75% {
background-color: red;
100% {
background-color: #1b2028;
}
}
然而,问题是只有一个关键帧在工作。即只有名称为box2 的关键帧有效,当我将box1 的关键帧放在顶部时它有效,为什么会这样。有人可以让我对关键帧有一个很好的理解吗? codepen的链接是:https://codepen.io/theredcap/pen/qvJdJa?editors=1100
【问题讨论】:
-
希望这对您的理解更有意义。 w3schools.com/css/css3_animations.asp
标签: css animation css-animations