表格行的背景不透明度

时间:2013-11-19 05:03:36

标签: javascript jquery html css

我想将不透明度的背景颜色应用于表格行,而不是将不透明度应用于表格数据<td>,我使用以下样式

 tr
    {
    background-color: #4682B4;
    filter:alpha(opacity=60); 
    -moz-opacity:0.6;/* Mozilla */
    opacity: 0.6;
    filter:alpha(opacity=60);
    }

它适用于Internet Explorer,不透明度仅适用于表格行而不适用于<td>,但对于其他浏览器,不透明度也适用<td>,因为它附加到{{1} }}

实际上我的鼠标悬停事件是

<tr>

2 个答案:

答案 0 :(得分:2)

请勿使用"样式,请按以下方式编写:

tr
{
  background-color: #4682B4;
  filter:alpha(opacity=60); /* IE */
  -moz-opacity:0.6; /* Mozilla */
  opacity: 0.6;
  filter:alpha(opacity=60);
}

答案 1 :(得分:1)

只需对background-color instead of HEX使用RGBA。

在你的情况下:

tr {
  background-color:rgba(70, 130, 180, 0.6)
}

RGBA的工作方式如下: (红色[0 - 255],绿色[0 - 255],蓝色[0 - 255],不透明度[0 - 1])。

相关问题