CSS3 过渡/悬停效果在 Firefox 中不起作用;火狐浏览器的错误?
我正在尝试使用 CSS3 创建一个鼠标悬停效果,将顶层向左滑动并显示底层。该代码在 Chrome 中有效,但在 Firefox 中无效......我又做了一些愚蠢的事情吗?感谢您的帮助!
编辑:我一定做错了什么,因为即使我省略了转换代码,当我将鼠标悬停在 Firefox 中的“图层”上时,也不会发生任何事情...:(
代码:
<html>
<div class="layers">
<div class="over">content</div>
<div class="under">content</div>
</div>
</html>
样式:
.layers {
position: relative;
width: 200px;
height: 50px;
overflow: hidden;
}
.over {
width: 200px;
height: 50px;
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
.under {
width: 200px;
height: 50px;
position: absolute;
top: 0px;
left: 0px;
}
.layers:hover .over {
left: -200px;
}
I'm trying to create a mouse-over effect that slides the top layer to the left and reveal the bottom layer using CSS3. The code works in Chrome but not in Firefox...did I do something stupid again? Thanks for your help!
Edit: I must have done something wrong, because even if I leave out the transition code, nothing happens when I hover over "layers" in Firefox...:(
The code:
<html>
<div class="layers">
<div class="over">content</div>
<div class="under">content</div>
</div>
</html>
The style:
.layers {
position: relative;
width: 200px;
height: 50px;
overflow: hidden;
}
.over {
width: 200px;
height: 50px;
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
.under {
width: 200px;
height: 50px;
position: absolute;
top: 0px;
left: 0px;
}
.layers:hover .over {
left: -200px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
原来 Firefox 中有一个错误(firefox悬停不透明度),我通过更改
为
I 解决了这个问题刚刚升级到 Firefox 5(从 Firefox 4);不知道bug是否已经修复了...
Turns out there is a bug in Firefox (firefox hover opacity) and I solved the problem by changing
to
I just upgraded to Firefox 5 (from Firefox 4); not sure if the bug has been fixed or not...
请参阅此问题:为什么我的 CSS3 过渡在 Firefox 中不起作用?
See this question: Why is my CSS3 Transition not working in Firefox?