html - Chrome 和 Chromium 有我的 <ul> 左边的一个像素,所有其他浏览器都显示完美

标签 html css google-chrome

它可能看起来很挑剔,但我似乎无法让我的菜单在 Chrome 下完美对齐,同时在所有其他浏览器下保持正确。

如果您使用 Chrome 查看 techwalrus.com 并将鼠标放在“类别”菜单上,您会注意到其下方的 UL 位于左侧 1 个像素处。

这是问题的屏幕截图。

http://i.imgur.com/cWXO2ev.png

所有其他浏览器都以正确的方式显示它。我该怎么办?

.nav{
width:100%;
background-color: #0066B9;
font-family: verdana;
font-weight: bold;
padding-top: 4px;
padding-bottom: 4px;
}


.nav ul{
width:960px;
margin:0 auto;
list-style: none;
padding: 0px;
}
.nav li{
display: inline;
position: relative;
background-color: #003E64;
white-space: nowrap;
padding-top: 4px;
padding-bottom: 4px;
}
.nav ul li a{
color: white;
text-decoration: none;
padding-left: 10px;
padding-right: 10px;
padding-top: 4px;
padding-bottom: 4px;
}
.nav ul li a:hover{
background-color: green;
padding-left: 10px;
padding-right: 10px;
}
.nav ul li ul{
display: none;
position: absolute;
width: auto;
left: 0;
margin-top: 4px;
}
.nav ul li:hover ul{
display: block;
}
.nav ul li ul li{
display: block;
width: auto;
}

最佳答案

一个适合你的快速解决方案

@media screen and (-webkit-min-device-pixel-ratio:0)
{
.nav ul li ul { margin-left:1px; }
}

关于html - Chrome 和 Chromium 有我的 <ul> 左边的一个像素,所有其他浏览器都显示完美,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31888537/

相关文章:

javascript - 根据 HTML 中的复选框使行可编辑

css - Bootstrap 日期选择器 : text not legible; How to change background color?

html - 当背景图片顶部有元素时缩放

html - Google Chrome 中的 Z-Index/滚动问题

android - 在移动设备或 iPad 上查看时背景图片无响应

javascript - 如何使用 jquery 在 div 中附加变量内容?

javascript - 单击按钮时不调用 Jquery

html - 如何将一个 div 定位到由其他两个 div 创建的间隙中

css - 如何自定义 Bootstrap?

google-chrome - 我一直在得到 "Failed to write to ' index.js'。请重试。”每当我尝试更新我的 lambda 函数代码时。为什么我会遇到这个问题?