View Full Version : seperate CSS files for IE and safari

04-07-2005, 07:16 AM
I would like to have two CSS file one that is included then you use safari and one that is included then you use Internet Explorer. How do I do it?

04-07-2005, 05:54 PM
Are you asking if you can use two different style sheets, one for Safari and one for Internet Explorer - or are you asking if you can use one style sheet for both and a separate, additional style sheet for either Safari and IE at the same time?

If you're just asking about two different style sheets for both Safari and IE, that's easy. You can specify any CSS file you want with either browser. (Had to check IE, since I don't normally use it. ^_^)

In Safari: From the 'Safari' menu, pick Preferences, then click 'Advanced.' Near the bottom of the window, there's a 'Style Sheet' drop-down where you can pick from a list of previously used stylesheets (if you've already had some added) or, pick 'Other' to load a new CSS.

In Internet Explorer: From the 'Explorer' menu, pick Preferences. Then, go to Web Browser > Web Content, and under 'Page Content,' place a checkmark by both 'Show style sheets' and 'Use my style sheet.' The 'Select Style Sheet...' button should become active, and you can use that to pick whatever CSS file you want.

If you were asking how to use more than one style sheet at a time, I'm not sure if that's possible, without perhaps merging the sheets into one large CSS. Someone who knows more about CSS use than me would have to answer that one.

04-23-2005, 10:00 PM
Assuming that this is a server-side question, it's really easy to do. Using your favourite scripting language, identify the browser with the HTTP headers and dump the appropriate css file down the pipeline. Refer your pages to "main.css.php" or whatever works on your server.

if (strpos($_SERVER["HTTP_USER_AGENT"], "Firefox") !== false) readfile "firefox.css";
if (strpos($_SERVER["HTTP_USER_AGENT"], "Opera") !== false) readfile "opera.css";
if (strpos($_SERVER["HTTP_USER_AGENT"], "Explorer") !== false) readfile "explorer.css";
// and so on