0

我正在使用我构建的简单菜单遇到一个特定于 Firefox 的错误

这是一个 ul-list,对列表项具有悬停效果,列表项transform:translateX(12px)在悬停时应用,并且文本链接始终应用负缩进,两者的组合创建了 Firefox 特定的错误,其中部分的文本在其动画期间在悬停时消失,看起来由于负值,它基本上被自己的填充隐藏了。

这是一个 JS Fiddle 以及代码,我是否缺少 -moz- css?

https://jsfiddle.net/CultureInspired/9435v0vy/1/

<ul class="menu_desktop">
                <li><a href="/">Home</a></li>
                <li><a href="/">About</a></li>
                <li><a href="/">Press</a></li>
                <li><a href="/">Contact</a></li>
</ul>

CSS:

.menu_desktop {
    list-style-type: none;
    margin: 80px;
    padding: 0;
}

.menu_desktop li {
    background: #fff;
    margin-bottom: 10px;
    text-indent: -.8em;
    text-transform: uppercase;
    letter-spacing: 6px;
    display: table;
    -webkit-transition: all 0.2s ease-out;
    -moz-transition: all 0.2s ease-out;
    -ms-transition: all 0.2s ease-out;
    -o-transition: all 0.2s ease-out;
    transition: all 0.2s ease-out;
}

.menu_desktop li:hover {
    transform: translateX(12px);
}

.menu_desktop a {
    color: #000;
    height: 100%;
    padding: 8px;
    display: block;
    text-decoration:none;
}
4

1 回答 1

1

我对 Firefox 49.0.2 也有同样的问题,这似乎是一个错误。

margin-left: 12px;您可以通过使用而不是transform您当前使用的来解决此问题。

这是修复(适用于 Firefox、chrome 和 ie):

body {
  background: lightgray;
}
.menu_desktop {
    list-style-type: none;
    margin: 80px;
    padding: 0;
}

.menu_desktop li {
    background: #fff;
    margin-bottom: 10px;
    text-indent: -.8em;
    text-transform: uppercase;
    letter-spacing: 6px;
    display: table;
    -webkit-transition: all 0.2s ease-out;
    -moz-transition: all 0.2s ease-out;
    -ms-transition: all 0.2s ease-out;
    -o-transition: all 0.2s ease-out;
    transition: all 0.2s ease-out;
}

.menu_desktop li:hover {
    margin-left: 12px;
}

.menu_desktop a {
    color: #000;
    height: 100%;
    padding: 8px;
    display: block;
    text-decoration:none;
}
<ul class="menu_desktop">
  <li><a href="/">Home</a></li>
  <li><a href="/">About</a></li>
  <li><a href="/">Press</a></li>
  <li><a href="/">Contact</a></li>
</ul>

于 2016-11-05T01:57:36.390 回答