dain Posted October 7, 2005 Share Posted October 7, 2005 Hi. As most of you probably know, its almost impossible to use the same CSS for every browser, so I had to make two, one for Netscape-based browsers, and a second one for IE-based browsers.That isnt too bad, but now I ran into another problem;I'm using this script to redirect the CSS depending on the browser: <![if !IE]> <link rel="stylesheet" type="text/css" href="ffstylesheet.css" /> <![endif]> <!--[if IE]> <link rel="stylesheet" type="text/css" href="iestylesheet.css" /> <![endif]--> It works perfectly on both browsers, but its not valid XHTML! So I change it to: <!--[if !IE]> <link rel="stylesheet" type="text/css" href="ffstylesheet.css" /> <![endif]--> <!--[if IE]> <link rel="stylesheet" type="text/css" href="iestylesheet.css" /> <![endif]--> And now its perfectly valid, but it wont load ANY CSS in Netscape.What do you think I should do?Thanks, dain Link to comment Share on other sites More sharing options...
actionsketch Posted October 8, 2005 Share Posted October 8, 2005 Well, I can't answer your question, but I can suggest a nice little hack for styles. When you have a style that you want to show up differently in IE, you just preceed it with a *.ex:margin-left: 20px;*margin-left: 22px;firefox will skip the * statement while IE takes the bait. Very handy Link to comment Share on other sites More sharing options...
dain Posted October 8, 2005 Author Share Posted October 8, 2005 it works, thanks, but it's not valid CSS, and I want it to be valid. Sorry i'm so strict about it.dain Link to comment Share on other sites More sharing options...
Webworldx Posted October 8, 2005 Share Posted October 8, 2005 Could just drop it into Javascript and write it that way? Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted September 16, 2007 Share Posted September 16, 2007 Try using this: <!--[if !IE]--> <link rel="stylesheet" type="text/css" href="ffstylesheet.css" /> <!--[endif]--><!--[if IE]> <link rel="stylesheet" type="text/css" href="iestylesheet.css" /> <![endif]--> Link to comment Share on other sites More sharing options...
croatiankid Posted September 16, 2007 Share Posted September 16, 2007 There's also a small article about them here. Link to comment Share on other sites More sharing options...
webspider25 Posted September 16, 2007 Share Posted September 16, 2007 Hi dain,Thanks for posting this code......as I was also facing the problem in running my css code on every browser.But now the issue with me is that I am not able to understand how its working.....as the code we are putting as commnmets which the browser shuld ignore.Than how its working???(I am sorry if I ma sounding stupid but I am new in all this).I need ur guide and help...bye There's also a small article about them here. Link to comment Share on other sites More sharing options...
boen_robot Posted September 16, 2007 Share Posted September 16, 2007 Excuse me all, but... am I the only one that sees how old this topic is? It's so old IE7 beta wasn't out yet. Not to mention the poster hasn't been around since... (checking up)... 12th November 2005. Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted September 16, 2007 Share Posted September 16, 2007 Hi dain,Thanks for posting this code......as I was also facing the problem in running my css code on every browser.But now the issue with me is that I am not able to understand how its working.....as the code we are putting as commnmets which the browser shuld ignore.Than how its working???(I am sorry if I ma sounding stupid but I am new in all this).I need ur guide and help...byeThat's the funny thing. Every other browser ignores the stuff except Internet Explorer reads the [if IE] or [if !IE] part. It is a hack around Internet Explorer. Link to comment Share on other sites More sharing options...
jlhaslip Posted September 17, 2007 Share Posted September 17, 2007 Excuse me all, but... am I the only one that sees how old this topic is? It's so old IE7 beta wasn't out yet. Not to mention the poster hasn't been around since... (checking up)... 12th November 2005.Noticed that myself... last night. thought maybe the Database got re-set or some such thing... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now