Conditional Style Sheets in IE9

a 夏天 提交于 2019-12-30 06:07:28

问题


IE9 is supposed to support conditional comments. I have the correct MIME type: 'type="text/css"'. All of the other conditional style sheets are being read into the correct browsers.

Here is what I cannot get to read in:

<!--[if IE 9]><link rel="stylesheet" type="text/css" href="includes/ie9.css"><![endif]-->

It is in the head with the rest of them, yet will not show up in the head in IE9.


回答1:


Sorry for the dumb questions but, have you cleared the cache and tested (try setting some border-color or something)? Is the css file path correct and accessible through your http server (try opening it with your browser and testing if it works without the conditional statement)? Another thing, I would go with gte (greater than or equals).

<!--[if gte IE 9]>
        <link rel="stylesheet" type="text/css" href="includes/ie9.css" />
<![endif]-->

Also check it there is none X-UA-Compatible meta tags around doing their usual monkey business (Nothing to do with conditional statements, but seems to be the root of many evils lately).




回答2:


I just tried this and it works

    <!--[if IE 9]>
    <script type="text/javascript">
    javascript:alert(document.documentMode);
</script>
<![endif]-->


来源:https://stackoverflow.com/questions/5953994/conditional-style-sheets-in-ie9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!