Reputation: 961
This is driving me nuts. I'm trying to use a conditional IE6 stylesheet. I posted this test page here. Here is the code I placed in my head tags:
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]-->
The ie6.css should set the body background to red when viewed in IE6.
What's wrong here? I'm sure it's something dumb. Could someone please point it out to me?
Upvotes: 3
Views: 1436
Reputation: 1
I just had a similiar issue. The conditional comments did not work correctly and I tried everything. The issue was that I had an X UA compatible meta tag in the header which obviuously influences the rendering. So keep watching out for that because that can be a reason.
<meta http-equiv="X-UA-Compatible" content="IE=7" />
Upvotes: 0
Reputation: 5308
is the CSS file in the root folder (same folder as the HTML) ? it's good practice to put your CSS in a separate folder.
<!--[if IE 6]><link href="css/ie6.css" rel="stylesheet" type="text/css" /><![endif]-->
Upvotes: 0
Reputation: 449465
You don't happen to be trying this using IETester?
Because with IETester, Conditional Comments will always resolve to the highest installed version of IE.
Upvotes: 2
Reputation: 37081
It works fine for me. Run your test page through IE NetRenderer and you'll see the red background. Perhaps you're testing it in a version of IE other than 6?
Upvotes: 2