tags:

views:

296

answers:

4

How can I add css to be only read by safari? bascially a div needs moving 5pixels to the left, as it shows fine on ff/ie etc

Thanks

EDIT - added code

code:

#subheading
{
background-color: #004376;
color: #ffffff;
height: 25px;
padding: 10px;
margin: 0 933px;
margin-top: -25px;
width: 761px; 
}
+1  A: 

you can have a check for a specific css property in webkit. This would likely work in chrome as well.

@media screen and (-webkit-min-device-pixel-ratio:0) {
        .someClass{
            color:#FF0000;
        }
    }
Jage
Thanks it seems to be a safari only bug? any chance I could get it only for this.
Elliott
Are you sure the bug isn't in chrome also? I think they have the same rendering engine.
Jage
yup I just checked and it looks fine.
Elliott
Safari uses the same rendering engine as Google Chrome (webkit), so it's unlikely to have a problem occur in only one of the those.If it truly only occurs on Safari, you might consider a Javascript solution. Even better, try to figure out why the problem is really happening and figure out a way to avoid browser-specific CSS.
Eric Wendelin
Thanks I have checked on both mac and pc and its only in Safari, I have added the code above its the margin it seems to be having a problem with.
Elliott
A: 

Found this:

http://dustinbrewer.com/css-hackgetting-safari-to-behave/

There's a little javascript involved, though. Did you using -webkit CSS?

tahdhaze09
A: 
margin: 0 933px;
margin-top: -25px;
width: 761px;

This doesn't sound right. The first line sets both left and right margin to 933px. And the width is 761px. The total width of the element would be (933 * 2 + 10 * 2 + 761) = 2647px.

Is this what you want it to be?

Chetan Sastry
I thought it would be something to do with this, but it seems to show fine on everything but safari. What would be the fix? thanks
Elliott
You may have other overrides. Can you post a link to your page or a small test case that reproduces your problem?
Chetan Sastry
http://elliottstocks.co.uk/youngs/new/1.html
Elliott
What should it look like? It looks the same in IE8, Firefox, Chrome to me.
Chetan Sastry
its fine on all them but safari....the subheading isnt in the correct place
Elliott
Safari(Win) too. The page you've linked appears the same in all browsers. I did not see any difference in Safari. The subheader is rendered towards the far right side of the menu bar.
Chetan Sastry
took screen shot - http://elliottstocks.co.uk/youngs/new/Capture.PNG
Elliott