Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    stylesheet link in conditional comments for ie

    because the * html thing doesn't seem to work in ie7, i'm trying to do this instead:

    Code:
    <!--[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.

  • #2
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    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.
    .
    .

  • #3
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    Code:
    <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.

  • #4
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    It's difficult without a live page, but your link to the IE stylesheet goes one directory up, try removing the ../ part?
    .
    .

  • #5
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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..

  • #6
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #7
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    .
    .

  • #8
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,611
    Thanks
    0
    Thanked 645 Times in 635 Posts
    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.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •