【发布时间】:2017-03-09 00:37:48
【问题描述】:
* {
margin: 0;
padding: 0;
}
/**BOX WORKING FINE**/
#box {
width: 20%;
height: 130px;
padding: 20px;
box-sizing: border-box;
position: relative;
top: 20px;
left: 30%;
background-color: blue;
color: white;
border-radius: 40px;
}
@keyframes nehal {
from {
background-color: blue;
}
to {
background-color: black;
padding: 10px;
top: 50px;
left: 10px;
background-image: linear-gradient(blue, black);
}
}
#box {
animation-name: nehal;
animation-duration: 4s;
animation-iteration-count: 3;
animation-direction: alternate-reverse;
animation-timing-function: steps(100);
}
/***ISN'T WORKING FINE****/
#zip {
background-color: red;
width: 15%;
height: 130px;
text-indent: 0px;
position: relative;
top: 200px;
left: 100px;
}
@keyframes flowz {
from {
background-color: red;
}
to {
text-align: center;
background-color: green;
left: 200px;
}
}
#zip {
animation-name: flows;
animation-delay: 4s;
animation-iteration-count: 3;
}
<h1>CSS3 Animations & Transitions</h1>
<div id="box">
<h3>Box!</h3>
</div>
<div id="zip">
<h4>Flowers</h4>
</div>
问题出现在第二个动画中,该动画无法正常工作,但第一个动画工作正常,但我尝试了第二个动画的所有内容,但仍然无法正常工作。
需要帮助!!谢谢你
【问题讨论】:
-
(a) 给出正确的
animation-name。 (b) 给animation-duration赋值。没有任何持续时间,就没有动画,因为持续时间的默认值为 0s。 (c) 以防万一您不知道,text-align属性不可动画/可转换。
标签: css animation css-animations keyframe