css3 animation demo

这个博客展示了如何使用CSS实现一个简单的动画效果,包括一个div元素左右移动的动画和一个p元素颜色渐变的动画。通过`@keyframes`规则定义了动画过程,`animation`属性指定了动画的细节,如持续时间、缓动函数和重复次数。博客内容对于理解CSS动画基础非常有帮助。
摘要由CSDN通过智能技术生成
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>animation</title>
    <style>
        div {
            width: 50px;
            height: 50px;
            position: absolute;
            background-color: royalblue;
            animation: yexianli 5s ease-in-out;
            animation-iteration-count: infinite;
        }

        @keyframes yexianli {
            from {
                left: 0px;
            }

            to {
                left: 100px
            }
        }

        p {
            width: 50px;
            height: 50px;
            position: absolute;
            top: 100px;
            background-color: royalblue;
            animation: yexianli1 5s ease-in-out;
            animation-iteration-count: infinite;
        }

        @keyframes yexianli1 {
            0% {
                background-color: skyblue;
            }

            25% {
                background-color: yellow;
            }

            50% {
                background-color: yellowgreen;
            }

            75% {
                background-color: green;
            }

            100% {
                background-color: royalblue;
            }
        }
    </style>
</head>

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

</html>

链接: 详细animation属性描述可以点击此跳转.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值