作为this question的后续内容,如何阻止Internet Explorer加载多个样式表,(因为我希望Firefox和Chrome加载一个样式表,而IE需要加载另一个样式表?)这是顺序吗?哪些引用被放置,或相同的文件名但在不同的文件夹中,我是否需要执行if else
类型的语句,或者什么?
例如,IE将加载两者:
<!--[if IE]>
<link href="/Content/SiteIE.css" rel="stylesheet" type="text/css">
<![endif]-->
<link href="/Content/Site.css" rel="stylesheet" type="text/css">
答案 0 :(得分:4)
完整的语法是:
<!--[if IE]>
According to the conditional comment this is IE<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is IE 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
<![endif]-->
<!--[if IE 8]>
According to the conditional comment this is IE 8<br />
<![endif]-->
<!--[if IE 9]>
According to the conditional comment this is IE 9<br />
<![endif]-->
<!--[if gte IE 8]>
According to the conditional comment this is IE 8 or higher<br />
<![endif]-->
<!--[if lt IE 9]>
According to the conditional comment this is IE lower than 9<br />
<![endif]-->
<!--[if lte IE 7]>
According to the conditional comment this is IE lower or equal to 7<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is IE greater than 6<br />
<![endif]-->
<!--[if !IE]> -->
According to the conditional comment this is not IE<br />
<!-- <![endif]-->
答案 1 :(得分:1)
是的,它会同时加载。但我有时做的是使IE特定规则具有更高的特异性,使其比其他浏览器的其他命令采用更高的顺序