简体   繁体   English

适用于不同浏览器Chrome和Firefox的条件内联CSS

[英]Conditional inline CSS for different browser chrome & firefox

I have written a css for div positioning. 我为div定位写了一个CSS。 here is the css 这是CSS

background-color: white; 
border-style: outset; 
margin: 115px 0px 0px -40px;

When I see the output in firefox then div position is ok but when I see this in chrome then output gets distorted due to margin: 145px 0px 0px -40px; 当我在firefox中看到输出时,div的位置就可以了,但是当我在chrome中看到时,由于margin: 145px 0px 0px -40px;输出就会失真margin: 145px 0px 0px -40px;

for chrome margin should be margin: 115px 0px 0px -40px; 镀铬边距应为margin: 115px 0px 0px -40px;

So I search google and found a snippet and I applied but did not work. 所以我搜索谷歌,发现一个代码段,我申请了,但没有用。 which was 那是

style="width:310;height:402;background-color:white;border-style:outset; if webkit (margin:115px 0 0 -40px) else  (margin:146px 0 0 -40px);"

So guide me how could I write conditional inline css for chrome...any idea. 因此,指导我如何为chrome编写条件内联CSS ...任何想法。 Thanks 谢谢

I wrote a test page, did not find what you said this situation. 我写了一个测试页,没有发现您所说的这种情况。 maybe you write a test page. 也许你写一个测试页。 Strictly speaking, firefox chrome is the standard of modern browers, should not have this kind of situation has. 严格来讲,Firefox是现代浏览器的标准,不应该有这种情况了。

*{ margin:0; padding:0;}
body{font:12px/1.5 arial;background:#fff;}
.test{background-color: white; border-style: outset; margin: 115px 0px 0px -40px;}

<div class="test"></div>

demo here 在这里演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM