I am having trouble with IE stylesheets. I have a few separate style sheets for my website- for ie6, ie7, ie8.
I am using a conditional comment to link my index.php to these stylesheets, and ie is not reading the styles.
This is the code for my condintional comment:

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

It's placed in the head of my doc, and the stylesheet is saved correctly, as style-ie8.css
The link to my site is http://www.pickpurple.org/

I would appreciate any help, as I've already googled... I cant come up with why this is happening...
Thanks!

Dani AI

Generated

Brief update: was right — Internet Explorer stopped honoring conditional comments starting with IE10, so an IE-only stylesheet linked via that syntax will not be applied in IE10/IE11. used the correct conditional-comment approach for IE9 and older, but if testing in a newer IE build the file will be ignored.

Quick troubleshooting checklist (fast wins):

  • Verify the actual engine/document mode in the browser (open DevTools and check Emulation/Document mode). If it is 10 or 11, conditional comments are inert.
  • Make sure a standards DOCTYPE is present so IE does not fall into quirks.
  • View the raw served HTML to confirm the conditional comment is actually in the output (build/minify steps sometimes strip comments).
  • Check Compatibility View / intranet settings — those can force different document modes.
  • As a short-term stopgap you can force an older engine via the X-UA-Compatible header (prefer sending it as an HTTP header or placing the meta/value before other head content), but this is a legacy workaround and not a recommended long-term solution.

Longer-term fixes to avoid version sniffing:

  • Use feature detection and progressive enhancement rather than browser-only conditionals. Consider Modernizr for behavior/feature tests (Modernizr).
  • Prefer CSS feature queries (@supports) for styling differences (MDN @supports).
  • If you absolutely must target IE10+/IE11 with CSS only, the -ms-high-contrast media query can scope rules to those engines:
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  /* IE10+ specific rules */
}

For enterprise/legacy scenarios, consider Microsoft Edge with IE mode rather than continuing to rely on obsolete IE behaviors (Edge IE mode).

Recommended Answers

All 3 Replies

So, i took a look and noticed that you have a conditional comment for IE10 as well. I assume that you tested the other versions of IE because if you only tested with IE10, you should note that IE10 does not support conditional comments.

Try this page with your IE browsers and see if the conditional comments are detected in the online demo/results section of the page: Conditional Comments for Internet Explorer

JorgeM, thanks for your response. I did not know that IE10 doesnt support conditional comments! Thank you.

No worries...here is a reference article on MSDN in case anyone is interested..

Conditional Comments

Support for conditional comments has been removed in Internet Explorer 10 standards and quirks modes for improved interoperability and compliance with HTML5. This means that Conditional Comments are now treated as regular comments, just like in other browsers. This change can impact pages written exclusively for Windows Internet Explorer or pages that use browser sniffing to alter their behavior in Internet Explorer.

apparently, you'd have to emulate IE9.

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">

I really dislike IE....argh!!

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.