zoukankan      html  css  js  c++  java
  • css3 gradient 渐变

    分为linear-gradient(线性渐变)和radial-gradient(径向渐变)。
    1.线性渐变在Mozilla 下应用
      语法:-moz-linear-gradient( [<point> || <angle>,]? <stop>, <stop> [, <stop>]* )
      参数;共三个参数,第一个参数表示为线性渐变的方向,top是从上往下,left 是从左到右 如果定义成left top,
      那就是从左上角到右下角。第二个和第三个参数分别是起点颜色和终点颜色。

    例如:

     background: -moz-linear-gradient( top,#ccc,#000);

    2.线性渐变在Webkit下的应用

      语法:-webkit-linear-gradient( [<point> || <angle>,]? <stop>, <stop> [, <stop>]* )
        //最新发布书写语法

     background: -moz-linear-gradient( top,#ccc,#000);

        //老式语法书写规则
      参数:-webkit-gradient是webkit引擎对渐变的实现参数,一共有五个。第一个参数表示渐变类型(type),
        可以是linear(线性渐变)或者radial(径向渐变)。第二个参数和第三个参数,都是一对值,分别
        表示渐变起点和终点。这对值可以用坐标形式表示,也可以用关键值表示,比如 left top(左上角)
        和left bottom(左下角)。第四个和第五个参数,分别是两个color-stop函数。color-stop函数接受
        两个参数,第一个表示渐变的位置,0为起点,0.5为中点,1为结束点;第二个表示该点的颜色。
      老式书写方法:background: -webkit-gradient(linear,center top,center bottom,from(#ccc), to(#000));
      新式书写方法:-webkit-linear-gradient(top,#ccc,#000);

    3.线性渐变在Oper 下的应用:
      语法:-o-linear-gradient([<point> || <angle>,]? <stop>, <stop> [, <stop>]);
      实例:background: -o-linear-gradient(top,#ccc, #000);

    4.线性渐变在Trident(IE)下的应用
      语法:filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB);/*IE<9>*/
        -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB)";/*IE8+*/
      IE依靠滤镜实现渐变。startColorstr表示起点的颜色,endColorstr表示终点颜色。
        GradientType表示渐变类型,0为缺省值,表示垂直渐变,1表示水平渐变。

    1、开始于center(水平方向)和top(垂直方向)也就是Top → Bottom:
      /* Firefox 3.6+ */
        background: -moz-linear-gradient(top, #ace, #f96);
      /* Safari 4-5, Chrome 1-9 */
      /* -webkit-gradient(, [, ]?, [, ]? [, ]*) */
        background: -webkit-gradient(linear,top,from(#ace),to(#f96));
      /* Safari 5.1+, Chrome 10+ */
        background: -webkit-linear-gradient(top, #ace, #f96);
      /* Opera 11.10+ */
        background: -o-linear-gradient(top, #ace, #f96);

    2、始于left(水平方向)和center(垂直方向)也是就Left → Right:
      /* Firefox 3.6+ */
        background: -moz-linear-gradient(left, #ace, #f96);
      /* Safari 5.1+, Chrome 10+ */
        background: -webkit-linear-gradient(left, #ace, #f96);
      /* Opera 11.10+ */
        background: -o-linear-gradient(left, #ace, #f96);

    3、起始于left(水平方向)和top(垂直方向):

      background: -moz-linear-gradient(left top, #ace, #f96);
      background: -webkit-linear-gradient(left top, #ace, #f96);
      background: -o-linear-gradient(left top, #ace, #f96);

    4、角度(Angle):
      没有角度的示例代码:

        background: -moz-linear-gradient(left, #ace, #f96);
        background: -webkit-linear-gradient(left,#ace,#f96);
        background: -o-linear-gradient(left, #ace, #f96);

      加上30度的角度代码:

        background: -moz-linear-gradient(left 30deg, #ace, #f96);
        background: -webkit-gradient(linear, 0 0, 100% 100%, from(#ace),to(#f96));
        background: -o-linear-gradient(30deg, #ace, #f96);
  • 相关阅读:
    HDU 2878 Great World of Goo
    HDU 4295 4 substrings problem
    UVALive 4975 Casting Spells
    UVA 10572 Black & White
    POJ 3133 Manhattan Wiring
    HDU 4267 A Simple Problem with Integers
    SPOJ 7258 Lexicographical Substring Search
    UVALive 4978 Fields and Farmers
    ssh连接aix问题与解决
    MDRT_<>$表
  • 原文地址:https://www.cnblogs.com/nmxs/p/5181032.html
Copyright © 2011-2022 走看看