css - firefox 悬停不透明度

标签 css opacity

我无法在 Firefox 或 IE 中更改悬停不透明度。它在 chrome 中工作。 Firefox 和 IE 能够使用 .move 中定义的不透明初始状态,但不能在悬停时使用。有任何想法吗。

<style>
.move{
  width:100px;
  height:100px;
  background-color:red;
  opacity:0.2;
  filter:alpha(opacity=20);
  }
.move:hover{
  opacity:1;
  filter:alpha(opacity=100);
  }
</style>

<div class="move"></div>

最佳答案

这是一个错误:http://support.mozilla.com/pa-IN/questions/746770

快速修复是替换:

.move:hover{

[class="move"]:hover{

使用在 http://www.xs4all.nl/~peterned/csshover.html 找到的脚本解决 IE 怪癖。

最终代码为

<style>
 body {
  behavior:url('csshover3.htc');
 }

.move{
  width:100px;
  height:100px;
  background-color:red;
  opacity:0.2;
  filter:alpha(opacity=20);
  -moz-opacity:0.2;
  -khtml-opacity: 0.2;
  }
.move:hover{
  opacity:1;
  filter:alpha(opacity=100);
  -moz-opacity:1.0;
  -khtml-opacity: 1.0;
  }
[class="move"]:hover{
  opacity:1;
  filter:alpha(opacity=100);
  -moz-opacity:1.0;
  -khtml-opacity: 1.0;
  }
</style>

<div class="move"></div>

您需要添加 -moz-opacity 和 -khtml-opacity 以支持 webkit 和较旧的 firefox 安装。

关于css - firefox 悬停不透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4686997/

相关文章:

linux - Linux 中的 Eclipse 不透明空白字符

Java:具有非透明组件的透明窗口?

javascript - 图像变暗/不透明

javascript - DIV 淡入另一个 DIV

css - 页脚不随框高移动

css - CSS3 Border Radius属性在localhost中不起作用?

html - 如何使模态停留在滚动条上

HTML背景不透明度不影响前景

css - 如何在 inputTextarea (PrimeFaces) 中设置固定高度

javascript - 如何将不同的样式应用于具有相同类的不同标签?