CSS创建颜色渐变 [英] CSS create color gradient
问题描述
有没有办法在CSS中创建一个颜色渐变而不使用图像文件?
Is there a way to create a color gradient in CSS without using an image file?
我试图给一个DIV一个背景颜色渐变,它看起来有光泽。
I am trying to give a DIV a background with a color gradient so that it looks glossy.
推荐答案
Safari(Webkit)支持它:
http://webkit.org/blog/175/introducing-css-gradients/
Safari (Webkit) supports it: http://webkit.org/blog/175/introducing-css-gradients/
Firefox 3.6+支持它:
https://developer.mozilla.org/en/CSS/-moz-linear-gradient
Firefox 3.6+ supports it: https://developer.mozilla.org/en/CSS/-moz-linear-gradient
W3规范支持它:
http://dev.w3.org/csswg/css3-images/#
您可以使用 Modernizr 检测支持并回退到图片上:
http://www.modernizr.com/docs/#cssgradients
And you can use Modernizr to detect support and fall back on an image: http://www.modernizr.com/docs/#cssgradients
这篇关于CSS创建颜色渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!