是否可以使用css2生成梯度?

时间:2012-08-08 14:32:46

标签: css

是否可以使用css2生成渐变?

注意: - 没有背景图片

2 个答案:

答案 0 :(得分:2)

没有。 使用纯CSS,只在CSS3中,但你可能会发现这很有用:
http://www.colorzilla.com/gradient-editor/

它生成与许多不同浏览器兼容的渐变。您只需将生成的CSS粘贴到工作表中即可。 这样您就无需在背景上加载图片。

答案 1 :(得分:1)

不,但这是最好的跨浏览器方法:

background-color: #ccc; // If gradients are not supported by browser

background-image:         linear-gradient( bottom, #ccc 0%, #ddd 100% );
background-image:      -o-linear-gradient( bottom, #ccc 0%, #ddd 100% );
background-image:    -moz-linear-gradient( bottom, #ccc 0%, #ddd 100% );
background-image: -webkit-linear-gradient( bottom, #ccc 0%, #ddd 100% );
background-image:     -ms-linear-gradient( bottom, #ccc 0%, #ddd 100% );
background-image:        -webkit-gradient( linear, left bottom, left top, color-stop(0, #ccc), color-stop(1, #ddd) );