使用animation-fill-mode属性设置动画未播放时元素的样式
现场演示<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 150px;
height: 200px;
position: relative;
background: red;
animation-name: myanim;
animation-duration: 2s;
animation-fill-mode: backwards;
}
@keyframes myanim {
from {left: 0px; background-color: green;}
to {left: 200px; background-color: blue;}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
以上就是设置动画未播放时元素的 CSS 样式的详细内容,更多请关注编程之家其它相关文章!