前两篇分别介绍了IE下CSS3的网页背景渐变、火狐下CSS3的网页背景渐变代码,两款代码都不是完美的,因为他们分别支持IE和火狐,现在就来介绍既支持Firefox又支持IE的网页背景渐变代码,欢迎阅读。 示例: <html> <head> <style type="text/css" rel="stylesheet"> .VeryHuo{ width:300px; height:150px; filter:alpha(opacity=100 finishopacity=50 style=1 startx=0,starty=0,finishx=0,finishy=150) progid:DXImageTransform.Microsoft.gradient(startcolorstr=red,endcolorstr=blue,gradientType=0); -ms-filter:alpha(opacity=100 finishopacity=50 style=1 startx=0,starty=0,finishx=0,finishy=150) progid:DXImageTransform.Microsoft.gradient(startcolorstr=red,endcolorstr=blue,gradientType=0);/*IE8*/ background:red; /* 一些不支持背景渐变的浏览器 */ background:-moz-linear-gradient(top, red, rgba(0, 0, 255, 0.5)); background:-webkit-gradient(linear, 0 0, 0 bottom, from(#ff0000), to(rgba(0, 0, 255, 0.5))); background:-o-linear-gradient(top, red, rgba(0, 0, 255, 0.5)); } </style> </head> <body> <div class="VeryHuo"></div> </body> </html><div style="text-align:center;margin:30px 0 0 0;"><hr style="color:#999;height:1px;">如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.veryhuo.com/' target='_blank'>http://www.veryhuo.com/</a></div>提示:可修改后代码再运行! 文章导航 CSS网页背景渐变代码,仅兼容chrome/Safari浏览器CSS3属性gradient实现FireFox网页背景渐变