...

View Full Version : How to change stylesheets for browsers?



winterdude
05-07-2007, 11:38 PM
Hi.

I'm looking for a way to change CSS sheets depending on the browser the user is on (IE or Other). I can not use and scripts as this template will be submitted to OSWD.org and that is prohibited.

felgall
05-07-2007, 11:58 PM
<link rel="stylesheet" type="text/css" href="main.css">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie.css">
<![endif]-->

winterdude
05-08-2007, 12:15 AM
That doesn't do anything :confused:

rmedek
05-08-2007, 12:23 AM
He's using conditional comments. All browsers load main.css. If the browser is IE, it loads ie.css. Other browsers ignore conditional comments.

winterdude
05-08-2007, 12:35 AM
Yes, I understand that. But when loading the page in IE (mac version) it doesn't show. But if I just put the edited CSS as the main template it shows with the fixes when loaded. Is it just because I'm testing with the Mac version?

nolvorite
05-08-2007, 12:56 AM
<link rel="stylesheet" type="text/css" href="main.css">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie.css">
<![endif]-->

only works on windows.

winterdude
05-08-2007, 01:18 AM
OK. That's fine Microsoft no longer supports IE for mac anyways :)

BWiz
05-08-2007, 03:08 AM
There are several methods to do this; I would mainly suggest JavaScript for this, or possibly a server side language such as PHP. Although it will be slightly more complicated to manage and create, it is certainly more universal than some other methods.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum