css3动画实例

本文详细介绍了CSS3中的动画效果,通过实例展示了如何创建平滑过渡、旋转、缩放和淡入淡出等效果,帮助读者深入理解并掌握CSS3动画在网页设计中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        body {
            background: #0ea9b1;
        }
        @keyframes bl {
            0% {
                bottom: 0;
            }
            50% {
                bottom: -50px;
            }
            100% {
                bottom: 0;
            }
        }
        @keyframes sun {
            0% {
                transform: translate(-50%,-50%) scale(1);
                box-shadow: 0px 0px 5px rgba(255,255,255,0.7);
            }
            50% {
                transform: translate(-50%,-50%) scale(1.1);
                box-shadow: 0px 0px 30px rgba(255,255,255,0.7);
            }
            100% {
                transform: translate(-50%,-50%) scale(1);
                box-shadow: 0px 0px 5px rgba(255,255,255,0.7);
            }
        }
        .sun {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            margin: 100px;
            position: relative;
        }
        .sun::before,.sun::after{
            content: '';
            border-radius: 50%;
            display: block;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);

        }
        .sun::before {
            width: 50px;
            height: 50px;
            background: rgba(255,255,255,0.8);
            animation: sun 2s infinite;
        }
        .sun::after {
            width: 80px;
            height: 80px;
            background: rgba(255,255,255,0.6);
            animation: sun 3s infinite;
        }
        img {
            width: 100%;
            position: absolute;
            left: 0;
            bottom: 0;
        }
        /*img:first-of-type {*/
            /*animation: bl 2s linear infinite;*/
        /*}*/
        img:last-of-type {
            animation: bl 2s linear 0.5s infinite;
        }
    </style>
</head>
<body>
<div class="sun"></div>
    <img src="images/1.png" alt="">
    <img src="images/2.png" alt="">

</body>
</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值