css3背景颜色渐变属性 兼容性测试基础环境为:windows系统;IE6.0+, Firefox4.0+, Chrome4.0+, Safari4.0+, Opera15.0+_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:24:48
Original
2196 people have browsed it

css3背景颜色渐变属性 兼容性测试基础环境为:windows系统;IE6.0+, Firefox4.0+, Chrome4.0+, Safari4.0+, Opera15.0+

语法:

:linear-gradient([ ,]? [, ]+);

:[ left | right ]? [ top | bottom ]? || ?

 [  |  ]?

取值:

left: 设置左边为渐变起点的横坐标值。 right: 设置右边为渐变起点的横坐标值。 top: 设置顶部为渐变起点的纵坐标值。 bottom: 设置底部为渐变起点的纵坐标值。 : 用角度值指定渐变的方向(或角度)。 : 指定渐变的起止颜色。

: 指定颜色。请参阅颜色值 : 用长度值指定起止色位置。不允许负值 : 用百分比指定起止色位置。

说明:

用线性渐变创建图像。

  • Firefox还支持使用和center特殊值定义渐变起点,并支持起点与角度一起使用。
  • 示例代码:


    (图一)

    linear-gradient(#fff,#333);linear-gradient(top,#fff,#333);linear-gradient(bottom,#333,#fff);linear-gradient(-90deg,#fff,#333);
    Copy after login

    以上几句代码都可以实现如(图一)的渐变效果

  • 兼容性:

  • 浅绿 = 支持
  • 红色 = 不支持
  • 粉色 = 部分支持
  • IE Firefox Safari Chrome Opera
    6-9 #1 4.0-15.0 -moz- 4.0-6.0 -webkit- 4.0-25.0 -webkit- #2 15.0
    10.0 16.0 6.1 26.0
    1. IE5.5-9.0使用私有滤镜来实现该效果: progid:DXImageTransform.Microsoft.Gradient()
    2. chrome4.0-9.0使用更老的语法:-webkit-gradient(linear,…)
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!