Longingforthesun
2016-07-06 10:49
@keyframes changeColor {
from {
background: red;
}
to {
background:green;
}
}
div {
width: 200px;
height: 200px;
background: red;
text-align:center;
margin: 20px auto;
line-height: 200px;
color: #fff;
}
div:hover {
animation-name: changeColor;
animation-duration:5s;
-webkit-animation-duration:5s;
animation-timing-function: ease-out;
animation-delay: 0.1s;
}
出于对回答者的认同和尊重,解决了你的问题,请采纳,谢谢
因为css文件不能以@开头,所以你在代码前面加一行注释就好了
/*不能以@开头*/ @keyframes changeColor { from { background: red; } to { background:green; } } div { width: 200px; height: 200px; background: red; text-align:center; margin: 20px auto; line-height: 200px; color: #fff; } div:hover { animation-name: changeColor; animation-duration: 5s; animation-timing-function: ease-out; animation-delay: .1s; }
删除掉@keyframes前面的@再提交就可以了
十天精通CSS3
242554 学习 · 2623 问题
相似问题