动画的基本使用

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 先定义动画 */
        
        @keyframes move {
            from {
                transform: translate(0, 0);
            }
            to {
                transform: translate(1000px, 0);
            }
        }
        
        div {
            width: 200px;
            height: 200px;
            background-color: pink;
            /* 调用动画 的名称 */
            animation-name: move;
            /* 调用动画的时间 */
            animation-duration: 1s;
        }
    </style>
</head>

<body>
    <div></div>
</body>

</html>

在这里插入图片描述

发布了68 篇原创文章 · 获赞 1 · 访问量 1024

猜你喜欢

转载自blog.csdn.net/weixin_42378409/article/details/104943481