尝试这样:
background: rgba(200, 54, 54, 0.5);
的前三个数字是红色,绿色和蓝色值的背景颜色,第四个是alpha通道。
alpha通道的工作方式与不透明度值相同。
对于IE 8这似乎不支持RGBA你需要一个不透明度属性下面这应该是更多的跨浏览器友好:
.transparent {
/* works for IE 5+. */
filter:alpha(opacity=30);
/* works for IE 8. */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
/* works for old school versions of the Mozilla browsers like Netscape Navigator. */
-moz-opacity:0.3;
/* This is for old versions of Safari (1.x) with KHTML rendering engine */
-khtml-opacity: 0.3;
/* This is the "most important" one because it's the current standard in CSS. This will work in most versions of Firefox, Safari, and Opera. */
opacity: 0.3;
}
来源
2013-08-29 22:44:31
Sir
我试图重现问题:http://jsfiddle.net/8UDtM /但我在IE8中看不到任何问题? – thgaskell
@thgaskell我用兼容模式使用IE,而jsfiddle完全搞砸了。 –