【发布时间】:2014-07-14 23:45:08
【问题描述】:
正如你在这里看到的http://goo.gl/mCY8KW(抱歉,无法在 JSfiddle 上重现)我的菜单项下方的小箭头在 Firefox 上是 1px 高(在 Chrome 和 Safari 上运行良好)
知道问题是什么以及如何解决吗?玩萤火虫我可以通过修改行高来修复它:
body {
color: #1a1a1a;
font-family: 'Open Sans';
font-size: 16px;
font-weight: 300;
line-height: 1.6;
}
...但是如果我这样做,我会搞砸整个页面的行高,这不是我想做的事情。我还尝试修改以在.menu-container 中应用 1.4 的行高,但如果我这样做,它在 Firefox 上看起来不错,但在 Safari 和 Chrome 中不再适用。
非常感谢您的帮助,
Safari 看起来不错:
火狐问题:
.menu-container {
float: right;
margin-top: 20px;
margin-right: 30px;
margin-left: auto;
width: auto;
}
nav {
float: right;
margin: 20px auto;
width: 100%;
}
nav ul {
margin-right: -4px;
margin-left: 5px;
text-align: right;
}
nav ul li {
display: inline-block;
margin-right: -4px;
margin-left: 5px;
vertical-align: top;
}
nav a {
padding: 4px 8px;
text-decoration: none;
color: rgba(255,255,255,1) !important ;
background: rgba(0,0,0,0.25);
text-transform: uppercase;
letter-spacing: 1.5px;
font-size: 14px;
font-weight: 400;
transition: all 0.5s ease;
}
nav a:hover {
border-top: 1px solid #234692;
border-bottom: none;
background: rgba(0,0,0,0.28) !important ;
}
nav ul li ul {
position: absolute;
display: block;
margin-top: 5px;
background: none;
padding-top: 5px
}
nav ul li ul li {
display: block;
float: none;
margin: 0;
padding: 0
}
nav ul li ul li a {
display: block;
text-align: left;
color: rgba(255,255,255,0.9) !important ;
text-shadow: 0 1px rgba(0,0,0,0.33) !important ;
padding: 10px
}
nav ul li ul li a:hover {
background: rgba(20,150,220,0.5) !important ;
color: white;
text-shadow: 0 1px rgba(0,0,0,0.5)
}
.hover a {
display: block;
}
.hover span {
color: rgba(255,255,255,0.9);
background: rgba(20,150,220,0.5);
border-radius: 5px;
position: absolute;
display: block;
margin: 5px 0 0 -57px;
padding: 10px;
font-size: 13px;
font-weight: 300;
letter-spacing: 1.5px;
text-transform: uppercase;
text-align: center;
cursor: default;
}
/*li.selected a{
border-bottom: 1px solid rgba(16,65,145,0.9);
}*/
.selected {
position: relative;
}
.menu-item-border {
border-top: 1px solid #234692;
}
li.selected a:after {
top: 25px;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(136, 183, 213, 0);
border-top-color: rgba(0,0,0,0.25);
border-width: 10px;
margin-left: -10px;
}
【问题讨论】:
-
您是否尝试过将单位添加到行高值的“详细”方式?对于一些迷信(或清晰),我总是更喜欢明确......也许Firefox也更喜欢它,我不确定:/
-
我从来没有使用过这个,但似乎stackoverflow.com/questions/952861/… 可以让你为你的
.menu-container应用样式,只用于firefox。