zoukankan      html  css  js  c++  java
  • css3 线性渐变和径向渐变

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title>线性渐变和径向渐变</title>
            <style type="text/css">
                #dd{
                     500px;
                    height: 200px;
                    /*线性渐变*/
                    background-image: linear-gradient(red,yellow);
                }
                #dd1{
                     500px;
                    height: 200px;
                    /*方向线性渐变*/
                    background-image: linear-gradient(to top right,red,yellow);
                }
                #dd2{
                     500px;
                    height: 200px;
                    /*角度线性渐变*/
                    background-image: linear-gradient(45deg,red,yellow);
                }
                #dd3{
                     500px;
                    height: 200px;
                    /*多种颜色等比例渐变*/
                    background-image: linear-gradient(to bottom right,red 0%,yellow 30%, orange 60%,green 100%);
                }
                #dd4{
                     500px;
                    height: 200px;
                    /*径向渐变*/
                    background-image: radial-gradient(green,blue);
                }
                #dd5{
                     500px;
                    height: 200px;
                    /*椭圆径向渐变*/
                    background-image: radial-gradient(ellipse,red,yellow);
                }
                #dd6{
                     500px;
                    height: 200px;
                    /*圆形可设置大小的径向渐变*/
                    background-image: radial-gradient(circle 100px,#000,#ff0000);
                }
                #dd7{
                     500px;
                    height: 200px;
                    /*重复的径向渐变*/
                    background-image:repeating-radial-gradient(circle 50px,#000,#ff0000);
                }
                /* 文字渐变 */
                .text-gradient {  
                    display: inline-block;
                    font-family: '微软雅黑';
                    font-size: 10em;
                    position: relative; 
                }  
                  
                .text-gradient[data-text]::after {  
                    content: attr(data-text);  
                    color: #FBEE00;  
                    position: absolute;  
                    left: 0;  
                    z-index: 2;
                    -webkit-mask-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#FBEE00), to(rgba(251,246,147,.6)));
                }
            </style>
        </head>
        <body>
            <h1>线性渐变</h1>
            <div id="dd">
                线性渐变
            </div>
            <div id="dd1">
                方向线性渐变
            </div>
            <div id="dd2">
                角度线性渐变
            </div>
            <div id="dd3">
                多种颜色等比例渐变
            </div>
            <h1>径向渐变</h1>
            <div id="dd4">
                两种颜色径向渐变
            </div>
            <div id="dd5">
                椭圆径向渐变
            </div>
            <div id="dd6">
                圆形可设置大小的径向渐变
            </div>
            <div id="dd7">
                重复的径向渐变
            </div>
            <h2 class="text-gradient" data-text="文字渐变">文字渐变</h2> 
        </body>
    </html>
    <script>
        var dd = document.getElementById("dd7");
        var xd = 50;
        setInterval(function(){
            xd+=5;
            if(xd>=100){
                xd=50;
            }
            dd.style.backgroundImage='repeating-radial-gradient(circle '+xd+'px,red,yellow)';
        },100);
    </script>
  • 相关阅读:
    进程和线程
    vue程序搭建
    EXTJS 不显示窗体 标题框的办法
    asp.net 本地资源连接没反映的解决办法
    IIS支持flv格式流传送的办法(解决flash播放器报200错误)
    response.write不要放到try里去,不然会报一个错误 a instance object什么的
    Webservice 用http get方式无法请求到的解决办法
    转一篇关于RIA的内存泄露的文章
    jquery的选择器$('')在IE6下对JS动态生成(比如ajax生成的)的元素失效的解决办法
    聚类存储过程分析
  • 原文地址:https://www.cnblogs.com/xianxianxxx/p/9646351.html
Copyright © 2011-2022 走看看