zoukankan      html  css  js  c++  java
  • 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)); /* 标准的语法(必须放在最后) */
    }

    结果:

  • 相关阅读:
    [DB2]删除大数据量数据及57011错误处理
    [DB2]DB2日常维护——REORG TABLE命令优化数据库性能
    [转]解读DIV CSS网页布局中CSS无效十个原因
    [DB2]DB2 sqlstate 57016 原因码 "7"错误
    [翻译]15个最常见的WCF问题
    [DB2]DB2数据库备份与恢复和导出表结构与导入导出表数据
    [转]网站(bs系统)怎样实现即时消息思路总结
    【摘抄】DB2字符集问题
    [转]jQuery必知必熟基础知识
    sql 2005/2008 订阅与发布的几个概念
  • 原文地址:https://www.cnblogs.com/agen-su/p/5911892.html
Copyright © 2011-2022 走看看