【问题标题】:Negative text indent, translate on hover bug (firefox)负文本缩进,在悬停错误(firefox)上翻译
【发布时间】:2017-03-18 22:39:53
【问题描述】:

我正在使用我构建的一个简单菜单遇到一个特定于 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;
}

【问题讨论】:

  • 在 Firefox 上对我来说很好。
  • 真的吗?这个问题发生在我的小提琴和我的网站上,每个单词的前两个字母左右在大约 1 秒内不可见。可能是我的硬件或操作系统?
  • 你真的需要li上的text-indent吗?
  • 我不知道可能是什么问题。 Here's what我明白了。
  • 哦,奇怪,是的,在您的示例中完美。谢谢!

标签: css firefox hover transform text-indent


【解决方案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>

【讨论】:

  • 谢谢这是一个很好的解决方法,希望他们能尽快解决这个问题!
  • 您是否打开了有关此问题的错误报告?如果他们不知道,我猜他们将无法修复它:)
猜你喜欢
  • 2015-11-02
  • 2021-08-22
  • 2019-02-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多