Jump to content

IE7 and the CSS woes......


FantomOptik

Recommended Posts

Well, the day has finally come. IE7 has been released and we are already seeing CSS issues with existing sites.Here is my dilemma:For most of my sites, I have created seperate CSS files for Mozilla browsers and for IE. Now that IE7 is out, this isn't working.This is the code that I used for browser specific CSS:<head><link rel="stylesheet" type="text/css" href="tms.css" /><!--[if IE]> <link rel="stylesheet" type="text/css" href="tmsIE.css" /><![endif]--></head>Now, up until today, this worked beautifully for me. I am wondering if there is a way, either by a similar code as the one above, or maybe a javascript file that would allow me to have specific CSS files for IE6, IE7 and Mozilla. Essentially, can I add another 'IF' statement to the above code and have it be specific to IE7?Thank you in advance for your help.UPDATE - I have figured out how to fix the issue and it was simply adjusting the if IE statement to read<!--[if IE 6]>This now reads as: if the browser is IE 6 or lower, use the IE.css. If the browser is anything else, including IE7, then use the regular CSS.

Link to comment
Share on other sites

For as long as I can remember, I have always said to people here use a conditional comment for your style sheets. I don't think that too many people wanted to do that. Luckily when I was informed about this, I thought it might be a good idea to try.As you just found, what a beauty that is to have now huh?! :)Here is what I have on all of my pages:

<link rel="stylesheet" type="text/css" media="screen, projection" href="/css/style.css" /><!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen, projection" href="/css/style_IE.css" /><![endif]-->

The lte IE 6 will detect v6 and earlier.Then, as you stated, just make another "if" statement to detect for v7. Problems solved.

Link to comment
Share on other sites

When adding the other statement for IE7, would it go in before the <![endif]--> statement?How would it look?

For as long as I can remember, I have always said to people here use a conditional comment for your style sheets. I don't think that too many people wanted to do that. Luckily when I was informed about this, I thought it might be a good idea to try.As you just found, what a beauty that is to have now huh?! :)Here is what I have on all of my pages:
<link rel="stylesheet" type="text/css" media="screen, projection" href="/css/style.css" /><!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen, projection" href="/css/style_IE.css" /><![endif]-->

The lte IE 6 will detect v6 and earlier.Then, as you stated, just make another "if" statement to detect for v7. Problems solved.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...