我想修复在 Google Chrome 和 Safari 上显示的 CSS 的一些错误,但是 Firefox 和 Opera mobil 显示正确。几年前发现在 ie7.css 中编写一些代码,例如 Internet Explorer 7 读取这些行并且可以解决错误。
现在我遇到了 chrome 和 android navigator 的问题,所以我认为如果这个 bug 可以在 Chrome 上解决,那么这个 bug 将在 andriod 平板电脑上得到修复。
例如我有一行:
.logo-social { position:relative; padding: 10px 0; margin-top:-10px; z-index:500; }
在 Firefox 上,我的社交栏出现在菜单和 slider 上方 -10px,在 chrome 上,购买出现在菜单和 slider 下方 20px,所以我设置 z-index:500; 显示在 slider 上方而不是后面。
如果我设置 margin-top:-25px 社交栏将在 Chrome 上正确显示 购买在 firefox 下看起来不合适。 :/
如果有像 IE7 或 IE8 这样的东西可以修复就太好了!
最佳答案
使用媒体查询技术
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* webkit specific rules here */
Body {}
}
这将针对 webkit 浏览器,或者您可以使用 javascript
关于css - 有一些 css 技巧可以根据浏览器纠正错误吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20726027/