Search code examples
htmlcssinternet-explorerconditional-comments

IE conditional stylesheet not loading


I have a rails app (source) where I am trying to change fix some display bugs in Internet Explorer. In app/views/layouts/application.html.haml I have:

/[if IE]                                                                                                                                                              
  = stylesheet_link_tag "ie", media: "all"

This seems to be generating the appropriate HTML with the precompiled asset which is downloadable from the server:

<!--[if IE]>
<link href="/assets/ie-21dfbd4e306a3f4685597c40061f9d43.css" media="all" rel="stylesheet" />
<![endif]-->

The contents of the stylesheet are simply:

#logo {
  display: none;
}

When the page is displayed in IE, however, the logo still appears.


Solution

  • According to this page in the Microsoft Developer Network Library, conditional comments were first supported in Internet Explorer 5, and are no longer supported in Internet Explorer 10 and later.