如何实现跨浏览器的不透明度渐变(不是颜色渐变)?请参阅以下代码:
<div style="background-color:Red;display:block;height:500px;width:500px;filter:alpha(Opacity=100, FinishOpacity=0, Style=1, StartX=0, StartY=0, FinishX=0, FinishY=500)"></div>它在IE中运行良好,但在火狐、safari..etc等其他浏览器中效果不佳。firefox的等效语法是什么?请不要建议我使用渐变图像。
发布于 2010-04-16 13:55:55
最新的火狐版本有-moz-linear-gradient,WebKit浏览器有-webkit-gradient。这两种颜色的透明度应该可以通过使用rgba颜色来实现。
https://developer.mozilla.org/en/CSS/-moz-linear-gradient
唯一真正100%跨浏览器兼容的解决方案是图片。
发布于 2010-04-22 13:20:25
谢谢@deceze,
我正在为其他有同样要求的人写样例css
top:0px;
opacity: 0.6;
width: 1944px;
height: 896px;
position: absolute;
z-index: 500;
background-color:#dcdcdc;
/* For WebKit (Safari, Google Chrome etc) */
background: -webkit-gradient(linear, left top, left bottom, from(#dcdcdc), to(rgba(215,212,207,0)));
/* For Mozilla/Gecko (Firefox etc) */
background: -moz-linear-gradient(top, #dcdcdc, rgba(215,212,207,0));
/* For Internet Explorer 5.5 - 7 */
filter:alpha(Opacity=70, FinishOpacity=0, Style=1, StartX=1242, StartY=0, FinishX=1242, FinishY=696);
/* For Internet Explorer 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70, FinishOpacity=0, Style=1, StartX=1242, StartY=0, FinishX=1242, FinishY=696)";https://stackoverflow.com/questions/2650891
复制相似问题