tags:

views:

87

answers:

3

hi,

how can I load a css file only for Safari browser ? I usually use just this (without javascript)

<!--[if IE 8]>
  <link href="ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->

for internet explorer 8. Thanks

A: 

Check out the CSS Browser selector plugin. It's really easy to implement and use, just write some special rules in your CSS, no extra stylesheets or anything. I use it and it works great!

Hope it helps :)

Kyle Sevenoaks
+2  A: 

I haven't seen a need to in ages (like Safari 2). Make a new question about the actual problem you're having and someone can probably tell you how to fix it with nothing but redundant CSS or less.

reisio
Also the small pictures on the frontpage anyway.. in Safari and Chrome the spacing is different.
Patrick
http://stackoverflow.com/questions/3091262/how-to-load-a-css-for-safari-only/3091547#comment-3174133
reisio
uh ? You meant I have to read the answers again ? :)
Patrick
+1  A: 

Real simple bit of PHP. Going to be an alternative for ASP too:

<?php
    $browser = get_browser();
    if($browser->browser == 'Safari') {
        echo '<link href="safari.css" rel="stylesheet" type="text/css" />';
    } 
?>
danixd
Why has this been downvoted exactly?
danixd
Im not sure, but maybe you linked to ie8.css and not safari.css
Wai Wong
Oh ha. Didn't notice that one! Thanks.
danixd
Look at the other answers/comments, it should be obvious.
reisio
Yes I know that, but I have still answered the question given. He might not have wanted to bug check his CSS.
danixd