IE8中的透明背景色

Joe*_*e Z 3 css internet-explorer html-table

有一个<tr>带background-color(绿色)的,而有些<td>则用其自己的(渐变)覆盖了行的背景。但是,大多数单元格都有部分单元格的背景图像(排序箭头)以及透明的背景色。那就是我现在要处理的。

除了 IE8 ,其他所有浏览器都可以正常工作。它显示带有白色背景的那些单元格。当我打开F12开发人员工具并取消选中该background-color: transparent属性时,<tr>显示中的绿色就应该显示为绿色。

由于我们需要排序箭头,因此我无法使用透明图像hackbackground-color。

如何使<tr>的绿色背景显示到IE8中的单元格?

Sir*_*Sir 5

尝试这样的事情:

background: rgba(200, 54, 54, 0.5);
Run Code Online (Sandbox Code Playgroud)

前三个数字是背景色的红色,绿色和蓝色值,第四个数字是Alpha通道。

Alpha通道的工作方式与不透明度值相同。

对于似乎不支持rgba的IE 8,您将需要一个opacity属性,以下该属性应更适合跨浏览器使用:

.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; 
}
Run Code Online (Sandbox Code Playgroud)