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

    结果:

  • 相关阅读:
    DA_06_iptables 与 firewalld 防火墙
    DA_05_Linux(CentOS6.7) 安装MySql5.7数据库
    DA_04_解决Xshell中文乱码问题
    3.NumPy
    2.NumPy简介
    1.python环境安装
    4.5. scrapy两大爬虫类_Spider
    redis 锦集
    一位资深程序员大牛给予Java初学者的学习路线建议
    idea 使用过程中的一些设置记录
  • 原文地址:https://www.cnblogs.com/agen-su/p/5911892.html
Copyright © 2011-2022 走看看