zoukankan      html  css  js  c++  java
  • 毛玻璃图层

    以前写毛玻璃用的都是图层覆盖,看了 LEA VEROU 的《CSS揭秘》后才发现还有更优雅的毛玻璃:

    <!DOCTYPE html>
    <html>
    
    <head>
        <title>原来你是这样的毛玻璃</title>
        <meta charset="utf-8">
    </head>
    <style>
        @keyframes ants {
            to {
                background-position: 100%;
            }
        }
    
        body, main:before {
            background: url("demoImages/1.jpg") 0 /cover fixed;
        }
    
        main {
            position: relative;
            background: hsla(0, 0%, 100%, .3);
            overflow: hidden;
            display: block;
            margin: 200px auto;
             1000px;
            height: 500px;
        }
    
        main:before {
            content: '';
            position: absolute;
            top: 0%;
            right: 0%;
            left: 0%;
            bottom: 0%;
            filter: blur(10px);
            margin: -30px;
        }
    
        .demoBox {
            border: .5em solid transparent;
            background: linear-gradient(white, white) padding-box,
            repeating-linear-gradient(-45deg, red 0, red 12.5%, transparent 0, transparent 25%, #58a 0, #58a 37.5%, transparent 0, transparent 50%) 0/5em 5em;
            animation: ants 12s linear infinite;
        }
    
        .demo {
            position: relative;
            z-index: 999;
            font-size: 5em;
            text-align: center;
            line-height: 5;
            font-weight: 100;
        }
    
    </style>
    <body>
    <main class="demoBox">
        <div class="demo">原来你是这样的毛玻璃</div>
    </main>
    </body>
    
    </html>
    
    效果图:
    

  • 相关阅读:
    手机体验细节小动画
    第一次用AngularJS
    鼠标离开方向检测
    回忆之placeholder
    回忆之日历
    大数据学习
    shell 二
    十三:变量、函数、存储过程、循环控制结构
    十二:事务与视图
    十一:约束
  • 原文地址:https://www.cnblogs.com/Zmmy/p/8526788.html
Copyright © 2011-2022 走看看