SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strange problem with conditional comments

    I started using conditional comments for the sites I design just over a year ago. I haven't encountered any problems with them - until now, that is.

    When testing some designs at a client site recently, I noticed that the same page was broken in IE when viewed on a test server, but fine when viewed on the development server. There is no difference between the files on the two servers: both the HTML and the CSS are identical.

    This also happens with every version of IE, but the page works fine when viewed in Firefox, Opera and Safari. The page renditions in IE are broken because it appears that the IE-specific stylesheets are not being pulled in by the conditional comments.

    Here's an excerpt of the HTML from the test page:-

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en">

    <head>
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
    <title>My test page</title>
    <style type="text/css">
    @import url("css/5.5/global.css");
    </style>
    <!--[if IE]>
    <link rel="stylesheet" href="css/5.5/blog_ie.css" type="text/css" />
    <![endif]-->
    <!--[if gt IE 6]>
    <link rel="stylesheet" href="css/5.5/blog_ie7.css" type="text/css" />
    <![endif]-->
    <!--[if lte IE 6]>
    <link rel="stylesheet" href="css/5.5/blog_ie6.css" type="text/css" />
    <![endif]-->
    <!--[if lt IE 6]>
    <link rel="stylesheet" href="css/5.5/blog_ie5x.css" type="text/css" />
    <![endif]-->

    </head>

    <body>
    ...
    </html>
    The behaviour of the page indicates that it must be something to do with the servers. The only significant difference between them is that the development server is running IIS 6 and the test server IIS 5.

    As you can imagine, it's driving me mad: I get a design to work on the development server, transfer it to the test server and it breaks.

    Has anyone come across this kind of problem? If not, does anyone have any idea what might be causing this erratic behaviour.

    Any and all suggestions much appreciated.

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could we have a link to play with?

  3. #3
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sorry, can't do that

    The page is on a client's internal network.

    I could put the page on an external server of mine, but that wouldn't prove much as the server isn't running IIS.

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just curious here, why are you using this?
    HTML Code:
    <style type="text/css">
    @import url("css/5.5/global.css");
    </style>

  5. #5
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Good question

    Well, the idea is to hide CSS from older browsers like Netscape 4. But that's not the format I typically use, which is:-

    <style type="text/css" media="all">
    <!--
    @import "styles/layout.css";
    -->
    </style>
    Do you think this could be causing a problem?

    I will change the page and re-test, but I doubt this is the cause: I have another older page with the same problem that uses <link rel ...> instead of @import.

    Update

    Sorry, I posted the wrong code (from a page I was playing around with).

    Here is the correct code:-
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en">

    <head>
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
    <title>My test page</title>
    <style type="text/css">
    <!--
    @import "css/5.5/global.css";
    -->
    </style>
    <!--[if IE]>
    <link rel="stylesheet" href="css/5.5/blog_ie.css" type="text/css" />
    <![endif]-->
    <!--[if gt IE 6]>
    <link rel="stylesheet" href="css/5.5/blog_ie7.css" type="text/css" />
    <![endif]-->
    <!--[if lte IE 6]>
    <link rel="stylesheet" href="css/5.5/blog_ie6.css" type="text/css" />
    <![endif]-->
    <!--[if lt IE 6]>
    <link rel="stylesheet" href="css/5.5/blog_ie5x.css" type="text/css" />
    <![endif]-->

    </head>

    <body>
    ...
    </html>

  6. #6
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, since Netscape 4 and Internet Explorer 4 comprise less than 0.1% of the total user market, I think you can safely drop "support" for those antiquated browsers. Internet Explorer 5 came out in 1999, and I don't even support that (IE 5.5 + I still do though). Netscape Navigator 4 came out in 1998 (IIRC - someone correct me if I'm wrong). It's now 2006, and we're getting ready to head into 2007. Why support browsers that are quickly approaching a decade in age?


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
  •