1

I have written a css for div positioning. here is the 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;

for chrome margin should be 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. Thanks

6
  • Are you using a css reset to begin with? Firefox and chrome should be the same when it comes to rendering. Commented Jan 14, 2013 at 9:22
  • Where did you get the snippet? Conditional CSS, requires a bit more than just adding the IF..etc... Commented Jan 14, 2013 at 9:23
  • i search google and found the snippet. Commented Jan 14, 2013 at 9:31
  • how to define margin-top:100px; margin-bottom:100px; margin-right:50px; margin-left:50px; for chrome Commented Jan 14, 2013 at 9:34
  • there are no if else conditions in css... wherever you found the snippet - this is wrong. Post some more of your markup, i find it very strange, that Chrome and FF differ that much. Probably there is a problem in your html. Commented Jan 14, 2013 at 9:40

1 Answer 1

1

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.

*{ 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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.