[英]CSS Hover-Effect isn't working in Firefox because of “display: inline;”
I've got a problem with the navigation of my website. 我的网站导航出现问题。 There's a button defined with "display: inline;", because otherwise the buttons wouldn't appear horizontal to each other.
有一个用“ display:inline;”定义的按钮,因为否则按钮将不会彼此水平出现。
Then I have a animation, a hover effect. 然后我有一个动画,一个悬停效果。 There it has to be "display: inline-block;", because Firefox wouldn't play the animation without that.
它必须是“ display:inline-block;”,因为如果没有Firefox,Firefox将无法播放动画。
The problem is that I've defined "display: inline;" 问题是我定义了“ display:inline;” first, so Firefox just ignores "display: inline-block;"
首先,因此Firefox仅忽略“ display:inline-block;”。 and the animation doesn't play.
并且动画无法播放。 The problem is only in Firefox, not in Chrome and not even in IE.
问题仅存在于Firefox中,而不存在于Chrome中,甚至不在IE中。
So here's the HTML-code: 因此,这是HTML代码:
<div id="nav">
<a href="projekte.html"><li class="sweep">PROJECTS</li></a>
</div>
And here's the CSS: 这是CSS:
#nav {
float: right;
width: auto;
font-size: 25px;
margin: 12px 10px 0px 0px;
}
#nav li {
list-style-type: none;
display: inline;
margin-right: 20px;
padding: 5px 10px 5px 10px;
}
#nav a {
text-decoration: none;
color: #3a96d3;
}
.sweep {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
position: relative;
-webkit-transition-property: color;
transition-property: color;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
}
.sweep:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #3a96d3;
-webkit-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.sweep:hover, .hvr-sweep-to-top:focus, .hvr-sweep-to-top:active {
color: white;
}
.sweep:hover:before, .hvr-sweep-to-top:focus:before, .hvr-sweep-to-top:active:before {
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
Thanks for your answers! 感谢您的回答!
如果您也将#nav li
设置为display: inline-block;
#nav li
什么不同display: inline-block;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.