Hi:
I have two external css files being loaded based on the following code in the head of my php file:
<![if !IE]>
<link rel="stylesheet" type="text/css" href="standard.css"/>
<![endif]>

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

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

I am testing in FF3.5 and IE8.

IE8 picks up standard.css in normal operation and ie7.css in compatability view.

The problem is FF picks up standards.css, ie7.css, then standard.css again.

Does anyone know why FF is doing this?

btw: the URL is

Dani AI

Generated

Short answer: Firefox was loading every stylesheet because the conditional-comment blocks in the page used the "revealed" form, so non‑IE browsers saw the content of each block as normal markup. That made Firefox follow every <link> it could find (so the base sheet, the IE7 sheet, then the base sheet again), rather than treating some blocks as IE‑only.

Why that happens: Internet Explorer supports two conditional‑comment styles — one that is hidden from other browsers and one that is revealed to them. The revealed variant is intentionally visible to non‑IE browsers, so any <link> inside it will be loaded by Firefox/Chrome. The observed duplicate load happens when the same stylesheet is referenced in more than one conditional block (or once inside a revealed block and once globally).

Practical fixes and safer patterns:

  • Prefer including the main stylesheet normally for all browsers, and add only the small IE overrides inside IE‑only conditional blocks. That prevents duplicating the main file.
  • Use the conditional comment form that hides IE‑only blocks from other browsers (the variant wrapped as an HTML comment) for any IE‑specific files.
  • Consider modern alternatives: feature detection (@supports or Modernizr) or server‑side user‑agent handling. Conditional comments target older IE only (they don’t work in IE10+), so they’re not a long‑term strategy.

Troubleshooting checklist:

  • View source to confirm which conditional style you used and whether a stylesheet appears more than once.
  • Use the browser Network panel (disable cache) to see actual requests and order.
  • Consolidate duplicate links and validate markup after changes.

As pointed out, fixing the conditional‑comment usage resolves the duplicate loads; several others in the thread (including , and ) reported the same outcome after applying that correction.

Recommended Answers

All 6 Replies

Your code was wrong. Should be

<!--[if gte IE 5.5]>
<link rel="stylesheet" type="text/css" href="standard.css" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="ie7.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="standard.css" />
<![endif]-->

It should be work. Good luck..

I muddled over this for hours and cannot tell you how much your help is appreciated.

Thanks Zero13 :)

Thanks Zero13, I also solving this bug for many days, IE really sux! I wish this browser will be gone for the next few years.

Your code was wrong. Should be

<!--[if gte IE 5.5]>
<link rel="stylesheet" type="text/css" href="standard.css" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="ie7.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="standard.css" />
<![endif]-->

It should be work. Good luck..

Yes. we all afraid IE bugs. Cheers... friend.

I had same issue with IE6. I tried to hire some web designers too but no one could realize the problem. Lastly I thought of using a new custom template. Thanks zero13 for your help.

Thanks to Zero 13 for solving this for me months past.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.