views:

116

answers:

4

I have a utility that scans through my css file and embeds images as base64 to reduce the amount of requests made to the server. Unfortunatly, IE does not support this.

I know how to include IE specific style sheets using conditional comments, but what about FF, Opera and Webkit? I don't want to give IE style sheets that it doesn't use.

Thanks

+2  A: 

There are no conditional comments for Firefox, Opera and Safari. I'm unsure whether you may load stylesheets with Javascript, but I would recommend against it either way.

It's common to have a server-side scripting language like PHP determine the client and serve corresponding CSS files. In PHP, the user agent may be identified by parsing the contents of $_SERVER['HTTP_USER_AGENT'].

If you're not comfortable with programming in PHP, there are a number of scripts that you could use. This one seems particularly promising.

Johannes Gorset
A: 

By reading the user-agent in the web request, you could serve up a different style sheet in your HEAD tags.

Jon Winstanley
+2  A: 

If I understand your question correctly, (and if I don't), you can exclude CSS files from IE using conditional comments:

<![if IE 9]>
IE will ignore this; other browsers won't.
<![endif]>
SLaks
Quote from OP: "I know how to include IE specific style sheets using conditional comments [...]"
Johannes Gorset
@FRKT: Include, but not exclude.
SLaks
oh, clever. ;-)
Johannes Gorset
A: 

Instead.The best way to do is using the following.

type="text/safari"

type="text/chrome"

read the following post for better explaination.

http://webgyani.com/2010/03/how-to-serve-different-stylesheets-only-to-safari-and-chrome/

-Amit

An Object