我在页面上有一个div,其他浏览器上的按钮排列整齐但是在chrome上,它们正在倒下。 我知道IE 7的明确黑客,就像* Margin,但不知道chrome.Is有一种方法在css中定义。 我不想要条件语句来处理这个问题。我需要明确提到chrome的负像素边距来拉动按钮。
答案 0 :(得分:0)
这个jQuery应该将class =“chrome”添加到文档的html元素中。
$(document).ready(function(){
if (navigator.userAgent.indexOf('Mac OS X') != -1) {
if (/chrome/.test(navigator.userAgent.toLowerCase())) { $('html').addClass('chrome'); }
} else {
if (/chrome/.test(navigator.userAgent.toLowerCase())) { $('html').addClass('chrome'); }
}
});
然后您可以像这样定位div:
.div {
margin-bottom: 10px;
}
html.chrome .div {
margin-bottom: 20px;
}
答案 1 :(得分:0)
这就像一个魅力
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* Safari and Chrome */
.act .now {
margin: -14% auto 0px;
}
/* Safari only override */
::i-block-chrome,.act .now {
margin: 5% auto 0px;
}}