PDA

View Full Version : IE7 conditional commenting problem



johnn7Devlpr
Aug 28th, 2007, 01:50 AM
Hi , I have recently ran into the problem of trying to get a stylesheet to link only for IE7.
<link rel="stylesheet" href="/images/howtohenna/henna.css" type="text/css">
<!-- [if IE 7]> <link rel="stylesheet" type="text/css" href="/images/howtohenna/ie7hack.css" /><![endif] -->

I have to put the condition inside the set tags , so I am not sure what is causing the problem but I can't figure it out , Please Help!, thanks

Arbitrator
Aug 28th, 2007, 02:01 AM
Hi , I have recently ran into the problem of trying to get a stylesheet to link only for IE7.
<link rel="stylesheet" href="/images/howtohenna/henna.css" type="text/css">
<!-- [if IE 7]> <link rel="stylesheet" type="text/css" href="/images/howtohenna/ie7hack.css" /><![endif] -->

I have to put the condition inside the set tags , so I am not sure what is causing the problem but I can't figure it outI donít think that the conditional comment is supposed to have spaces around the doubled Hyphen‐Minus (--) characters.


<!--[if IE 7]> <link rel="stylesheet" type="text/css" href="/images/howtohenna/ie7hack.css" /><![endif]-->You may want to use gte (greater‐than or equal to), by the way, in case a new version of Internet Explorer comes along (i.e., <!--[if IE gte 7]>).

I should also point out that your code is inconsistent. Either youíre using XHTML and should have trailing slashes (/) in your empty element tags or youíre using HTML and should not.

johnn7Devlpr
Aug 28th, 2007, 02:04 AM
I realize my code is inconsistent there , i had copied the comment from another project, I have already tried with no space around the hyphens and still no success , any other Idea's? thanks for the reply bytheway

Arbitrator
Aug 28th, 2007, 02:30 AM
I have already tried with no space around the hyphens and still no success , any other Idea's?I made a mistake; <!--[if IE gte 7]> should be <!--[if gte IE 7]>. If that doesnít work, then I can only guess that the issue is with the remainder of your code, the document, or the browser.

Edit: You can see a working example of a document that uses an Internet Explorer 7 conditional comment at http://www.jsgp.us/demos/D0001.html for a reference of what should work.

butlins
Aug 28th, 2007, 07:57 PM
There's quite a lot on conditional comments on this page at Position is Everything (http://www.positioniseverything.net/articles/multiIE.html), and as a bonus, there's a link to an installer for multiple IE standalones (IE3.2 anyone?).