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)); /* 标准的语法(必须放在最后) */
    }

    结果:

  • 相关阅读:
    DTO vs. Assembly(转载)
    DDD:整理了一些关于验证方面的文章
    幸福框架:模块化开发
    .NET:异常以及异常处理框架探析(转载)
    Azure 基础:Queue Storage
    Azure 基础:File Storage
    Azure 基础:Blob Storage
    Azure 基础:Table storage
    用 IIS 搭建 mercurial server
    Azure 基础:使用 powershell 创建虚拟网络
  • 原文地址:https://www.cnblogs.com/agen-su/p/5911892.html
Copyright © 2011-2022 走看看