2013-08-29 220 views
2

<tr>background-color(绿色)和一些<td> s用自己的(渐变)重写行的背景。但是,大多数单元格都具有用于部分单元格的背景图像(排序箭头)以及透明背景颜色。这就是我现在要处理的事情。IE8中的透明背景颜色

所有在浏览器中正常工作的除了 IE8。它显示那些白色背景的细胞。当我打开F12 Developer Tools并取消选择background-color: transparent属性时,<tr>中的绿色显示为,应该如此。

我不能使用transparent image hack,因为我们需要background-color作为排序箭头。

如何让<tr>的绿色背景展示给IE8中的单元格?

+0

我试图重现问题:http://jsfiddle.net/8UDtM /但我在IE8中看不到任何问题? – thgaskell

+0

@thgaskell我用兼容模式使用IE,而jsfiddle完全搞砸了。 –

回答

4

尝试这样:

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; 
} 
+1

它实际上工作和绿色显示通过,但背景图像消失。 –

+0

@JoeZ尝试使用'background-color'而不是'background',这听起来像是重写了'background-image'属性。 – thgaskell

+0

你明白了。实际上,排序图像被设置为“背景”而不是“背景图像”。如果你更新了答案,我会接受它。 –