我的网站导航问题.有一个用"display:inline;"定义的按钮,因为否则按钮不会相互呈现水平.
然后我有一个动画,一个悬停效果.它必须是"display:inline-block;",因为没有它,Firefox就不会播放动画.
问题是我已经定义了"display:inline;" 首先,所以Firefox只是忽略"display:inline-block;" 并且动画不播放.问题仅出在Firefox中,而不是Chrome中,甚至不出现在IE中.
所以这是HTML代码:
这是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); }
谢谢你的回答!
如果你#nav li
也设置为,它应该没有区别display: inline-block;