呼吸按钮 - 纯CSS

CSS呼吸按钮

直接上代码

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <title>呼吸按钮</title>
    <style type="text/css">
    *{
        margin: 0;
        padding: 0;
    }
    .breath_light {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border-radius: 20px;
        width: 40px;                                    
        height: 40px;
        overflow: hidden;
        background: #99dd33;
      
        /* IE10、Firefox and Opera,IE9以及更早的版本不支持 */
        animation-name: breath;                         /* 动画名称 */
        animation-duration: 1s;                         /* 动画时长3秒 */
        animation-timing-function: ease-in-out;         /* 动画速度曲线:以低速开始和结束 */
        animation-iteration-count: infinite;            /* 播放次数:无限 */
     
        /* Safari and Chrome */
        -webkit-animation-name: breath;                 /* 动画名称 */
        -webkit-animation-duration: 1s;                 /* 动画时长3秒 */
        -webkit-animation-timing-function: ease-in-out; /* 动画速度曲线:以低速开始和结束 */
        -webkit-animation-iteration-count: infinite;    /* 播放次数:无限 */
    }
     
    @keyframes breath {
        from { opacity: 1; width: 40px; height: 40px; }                          /* 动画开始时 */
        50%  { opacity: 1; width: 60px; height: 60px; border-radius: 30px;}      /* 动画50% 时 */
        to   { opacity: 1; width: 40px; height: 40px; }                          /* 动画结束时 */    
    }
     
    @-webkit-keyframes breath {
        from { opacity: 1; width: 40px; height: 40px; }                          /* 动画开始时 */
        50%  { opacity: 1; width: 60px; height: 60px; border-radius: 30px;}      /* 动画50% 时 */
        to   { opacity: 1; width: 40px; height: 40px; }                          /* 动画结束时的 */
    }
    </style>
</head>
<body>
    <div class="breath_light" title="呼吸按钮"></div>
</body>
</html>
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 问答题47 /72 常见浏览器兼容性问题与解决方案? 参考答案 (1)浏览器兼容问题一:不同浏览器的标签默认的外补...
    _Yfling阅读 14,348评论 1赞 92
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 180,485评论 25赞 708
  • 作者:狼狼的蓝胖子原文地址:http://luopq.com/2016/01/05/css-optimize/ 写...
    IT程序狮阅读 1,869评论 2赞 51
  • 一如既往,上午听VOA医疗app的段子并试着听写下来,虽然磕磕绊绊但多听几遍终是可以听准确的,这是很增长信心的。下...
    就是有点倔阅读 265评论 0赞 0
  • 新鲜呀 这几年懒了不少,基本是不写文字了。换过这么多地方,其实也不知道自己在找什么,只知道如果以往一直固定在一个地...
    大狼阅读 389评论 0赞 0

友情链接更多精彩内容