IE conditional stylesheet not loading

257 views Asked by At

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.

2

There are 2 answers

0
arandompenguin On BEST ANSWER

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.

0
SDJMcHattie On

If you are in fact not using IE10, do you have a second style sheet for non-IE browsers? Is this before or after this conditional comment in your HTML? If it is after and it contains #logo { display: block; } or similar its styles will override that of the IE specific CSS file.