css (animation) 动画

2021-09-10  本文已影响0人  xueyueshuai
<!DOCTYPE html>
<html>

<head>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: red;
            animation-name: example;
            animation-duration: 4s;
        }

        @keyframes example {
            from {
                background-color: red;
            }

            to {
                background-color: yellow;
            }
        }
    </style>
</head>

<body>

    <p><b>注释:</b>本例在 Internet Explorer 9 以及更早的版本中无效。</p>

    <div></div>

    <p><b>注释:</b>当动画结束后,会变回最初的样式。</p>

</body>

</html>
上一篇 下一篇

猜你喜欢

热点阅读