简体   繁体   中英

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.

根据Microsoft Developer Network Library中的此页面, Internet Explorer 5首先支持条件注释,而Internet Explorer 10及更高版本不再支持条件注释。

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; } #logo { display: block; } or similar its styles will override that of the IE specific CSS file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM