【CSS3动画】简单实现背景闪烁,文字闪烁 兼容IE11

相关配置兼容性属 教程 等参考这个就够了:
https://www.w3school.com.cn/css3/css3_animation.asp

以下示例测试了chrome / IE11 / 火狐浏览器


背景闪烁:


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        body{padding: 50px;}
        .blink {
            width: 100px;height:100px;
            line-height: 100px;
            font-size:15px;
            background-color:#ff0;
            text-align: center;
            animation:aBlink 300ms infinite;
            -webkit-animation:aBlink 300ms infinite;
        }

        @keyframes aBlink {
            from { background-color:#ff0; }
            50%{background-color:#f00;}
            to { background-color:#ff0; }
        }

        @-webkit-keyframes aBlink {
            from { background-color:#ff0; }
            50%{background-color:#f00;}
            to { background-color:#ff0; }
        }

    </style>
</head>
<body>

<div class="blink">背景闪烁</div>
</body>
</html>

效果图:
在这里插入图片描述


文字闪烁:

基本都一样, 把background-color 换成 color 就行:


@keyframes  aniColor1 {
            0% {
                color: #f00;
            }
            50% {
                color: #FFC100;
            }
            100% {
                color: #f00;
            }
        }

效果图:
在这里插入图片描述

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值