...

View Full Version : stylesheet link in conditional comments for ie



peterworth
07-05-2007, 12:48 PM
because the * html thing doesn't seem to work in ie7, i'm trying to do this instead:



<!--[if IE]>
<link rel="stylesheet" type="text/css" href="../iehacks.css" />
<![endif]-->


but nothing happens at the moment. the strange thing is that if i take the conditional comments away, then the stylesheet loads and works fine, so that can't be the problem, but likewise the conditional comments can't be the problem because if i put some text inside them, it appears in ie and not in firefox, as it should. any ideas why the 2 together doesn't work? thanks.

Jutlander
07-05-2007, 01:00 PM
The * html hack only works on IE 5 and 6 yes.

That should work... a link to your page would be nice, cause then we can see how your site is set up. :)

peterworth
07-05-2007, 01:20 PM
yeah, it should work.. but it doesn't :(

sorry, site isn't up yet. it's a dreamweaver thing with templates so there are editable regions dotted around, but if i do view source, the whole head of the page is just this:



<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>test page</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" type="text/css" href="style.css" />
<!--[if IE]>
hullo.
<link rel="stylesheet" type="text/css" href="../iehacks.css" />
<![endif]-->
<script type="text/javascript" src="drop_down.js"></script>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>


the "hullo." appears in ie and firefox, but the iehacks stylesheet gets applied to niether.

Jutlander
07-05-2007, 01:26 PM
It's difficult without a live page, but your link to the IE stylesheet goes one directory up, try removing the ../ part?

peterworth
07-05-2007, 02:40 PM
ah but that's the interesting thing - there's nothing wrong with the link, because if i take away the conditional tags, then the stylesheet gets applied fine. i'll try taking them away anyway..

peterworth
07-05-2007, 02:44 PM
having said that, it seems to have worked now that i've taken out the ..

i don't understand it, it must be something to do with dreamweaver - when inside the conditional tags, the local directory is different for some reason. weird.

anyway, i'm glad it's working. thanks for the help!

Jutlander
07-05-2007, 03:29 PM
:thumbsup:

felgall
07-05-2007, 09:36 PM
Those conditional comments ONLY work in Internet Explorer. To Dreamweaver the whole thing is a comment just the same as in Firefox, Opera, or Safari.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum