• css渐变知识知多少


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>教程(runoob.com)</title>
    <style>
    #grad1 {
    height: 200px;
    background: -webkit-linear-gradient(red, blue); /* Safari 5.1 - 6.0 */
    background: -o-linear-gradient(red, blue); /* Opera 11.1 - 12.0 */
    background: -moz-linear-gradient(red, blue); /* Firefox 3.6 - 15 */
    background: linear-gradient(red, blue); /* 标准的语法(必须放在最后) */
    }
    </style>
    </head>
    <body>

    <h3>线性渐变 - 从上到下</h3>
    <p>从顶部开始的线性渐变。起点是红色,慢慢过渡到蓝色:</p>

    <div id="grad1"></div>

    <p><strong>注意:</strong> Internet Explorer 9 及之前的版本不支持渐变。</p>

    </body>
    </html>

    结果:

    当然也可以从任意方向开始渐变:上到下;左到右;

    对角

    #grad1 {
    height: 200px;
    background: -webkit-linear-gradient(left top, red , blue); /* Safari 5.1 - 6.0 */
    background: -o-linear-gradient(bottom right, red, blue); /* Opera 11.1 - 12.0 */
    background: -moz-linear-gradient(bottom right, red, blue); /* Firefox 3.6 - 15 */
    background: linear-gradient(to bottom right, red , blue); /* 标准的语法(必须放在最后) */
    }
    </style>
    </head>
    <body>

    <h3>线性渐变 - 对角</h3>
    <p>从左上角开始(到右下角)的线性渐变。起点是红色,慢慢过渡到蓝色:</p>

    <div id="grad1"></div>

    结果:

    角度

    #grad1 {
    height: 100px;
    background: -webkit-linear-gradient(0deg, red, blue); /* Safari 5.1 - 6.0 */
    background: -o-linear-gradient(0deg, red, blue); /* Opera 11.1 - 12.0 */
    background: -moz-linear-gradient(0deg, red, blue); /* Firefox 3.6 - 15 */
    background: linear-gradient(0deg, red, blue); /* 标准的语法(必须放在最后) */
    }

    透明度

    #grad1 {
    height: 200px;
    background: -webkit-linear-gradient(left, rgba(255,0,0,0), rgba(255,0,0,1)); /* Safari 5.1 - 6.0 */
    background: -o-linear-gradient(right, rgba(255,0,0,0), rgba(255,0,0,1)); /* Opera 11.1 - 12.0 */
    background: -moz-linear-gradient(right, rgba(255,0,0,0), rgba(255,0,0,1)); /* Firefox 3.6 - 15 */
    background: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1)); /* 标准的语法(必须放在最后) */
    }

    结果:

  • 相关阅读:
    云计算-MapReduce
    云计算--hbase shell
    云计算--hdfs dfs 命令
    云计算--MPI
    jQuery 效果
    jQuery 效果
    JQuery效果隐藏/显示
    JQuery教程
    六级啊啊啊
    jQuery 安装
  • 原文地址:https://www.cnblogs.com/agen-su/p/5911892.html
Copyright © 2020-2023  润新知