【发布时间】:2014-08-14 11:31:04
【问题描述】:
我在图像上制作了这种悬停效果,它可以正常工作。火狐除外。 粉红色背景有效,但正方形没有过渡。我尝试使用-moz-transform,没有用。我尝试将'all'更改为transform,但仍然无效。
有人可以帮我吗?
这是小提琴:
HTML:
<div id="img">
<div id="overlay">
<div class="expand">
</div>
</div>
</div>
CSS:
#img {
height: 150px;
width: 350px;
background: url('http://placehold.it/350x150');
}
#img #overlay {
background: rgba(229, 66, 147, 0);
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
height: 150px;
width: 350px;
}
#img #overlay:hover {
display: block;
position: absolute;
background: rgba(229, 66, 147, 0.6);
z-index: 20;
overflow: hidden;
height: 150px;
width: 350px;
}
.expand {
display: inline-block;
margin: auto;
margin-left: 39%;
margin-top: 12%;
z-index: 100;
width: 60px;
height: 60px;
border: solid 5px #fff;
color: #fff;
line-height: 50px;
font-weight: 700;
font-size: 30px;
transform: scale(0);
opacity: 0;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
#img #overlay:hover .expand {
transform: scale(1);
opacity: 1;
}
【问题讨论】:
-
我不知道有什么影响,但是当您将
position: absolute;和overflow: hidden;从#img #overlay:hover移动到#img #overlay时,FireFox 似乎一切正常! -
工作正常!非常感谢。
-
我找到了原因 - FF 中有一个错误 - 我已经用简短的描述添加了你的问题的答案 - link
-
如果我的回答完全让你满意,请回答这个问题:)
标签: css