SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with Conditional Comments for IE

    If you view any of the following pages with Firefox, then Internet Explorer, you'll see some navigation links in the top left corner of the page in Firefox, but nothing in IE:

    http://www.geobop.org/World/Arizona
    http://www.world.org/Arizona
    http://www.geozoo.org/World/Arizona
    http://www.geosymbols.org/World/Arizona
    http://www.politix.us/World/Arizona

    I haven't been able to figure out how to fix it, but I'd at least like to stop jerking Firefox around while trying to solve it. So I decided to use a conditional comment to display a CSS style for IE only. But it doesn't seem to work.

    To test it, I inserted an outrageous style...

    body ( font-size: 250% )

    It works in both Firefox and IE if I remove the conditional comments. But with the conditional comments, it doesn't work in either one. So I guess I'm not writing my conditional comment tags correctly. Can someone show me how you do yours?

    This is what I have in my HTML:

    PHP Code:
    echo '<!--[if gte IE 5]
    <link href="'
    .$BaseURL.'/a1/css/microsux.css" rel="stylesheet" type="text/css" />
    [endif]-->'
    ;
    ?> 
    And this is what I see in my source code with IE:

    PHP Code:
    <!--[if gte IE 5]
    <
    link href="http://www.geobop.org/a1/css/microsux.css" rel="stylesheet" type="text/css" />
    [endif]--> 
    Here's my source code for Firefox, though the text appears to be commented out:

    PHP Code:
    <!--[if gte IE 5]
    <
    link href="/a1/css/microsux.css" rel="stylesheet" type="text/css" />
    [endif]--> 
    Thanks.

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    They're wrong. You're missing <! before the endif.

    PHP Code:
    <!--[if gte IE 5]
    <
    link href="/a1/css/microsux.css" rel="stylesheet" type="text/css" />
    <![endif]--> 
    Don't you think you could have just typed "conditional comments" into google and found this out for yourself?

  3. #3
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles
    They're wrong. You're missing <! before the endif.

    PHP Code:
    <!--[if gte IE 5]
    <
    link href="/a1/css/microsux.css" rel="stylesheet" type="text/css" />
    <![endif]--> 
    Thanks, I'll try it again.

    Don't you think you could have just typed "conditional comments" into google and found this out for yourself?
    I already tried Google. I didn't realize I had accidentally deleted the <!.

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I didn't notice you're also missing the > from the opening tag. It should be:
    Code:
    <!--[if gte IE 5]>
    <link href="/a1/css/microsux.css" rel="stylesheet" type="text/css" />
    <![endif]-->


Bookmarks

Posting Permissions

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