负文本缩进,悬停错误翻译(firefox)
Negative text indent, translate on hover bug (firefox)
我在构建一个简单的菜单时遇到了 firefox 特定的错误
这是一个 ul-list,对列表项有悬停效果,列表项在悬停时应用 transform:translateX(12px)
,文本链接始终应用负缩进,组合两者中的一个创建了一个 Firefox 特定的错误,其中部分文本在其动画期间悬停时消失,看起来它基本上被它自己的填充隐藏了,因为负值。
这是一个JSFiddle和代码,我是不是漏了-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 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>
我在构建一个简单的菜单时遇到了 firefox 特定的错误
这是一个 ul-list,对列表项有悬停效果,列表项在悬停时应用 transform:translateX(12px)
,文本链接始终应用负缩进,组合两者中的一个创建了一个 Firefox 特定的错误,其中部分文本在其动画期间悬停时消失,看起来它基本上被它自己的填充隐藏了,因为负值。
这是一个JSFiddle和代码,我是不是漏了-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 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>