Asp.net IE10有条件IE评论<--&燃气轮机;功能启用码

Asp.net IE10有条件IE评论<--&燃气轮机;功能启用码,asp.net,css,internet-explorer,conditional-statements,Asp.net,Css,Internet Explorer,Conditional Statements,在IE10中调试我的ASP.NETMVC(基于Razor的)网站时,我仍然需要设置特定于IE的css。使用IE条件注释时,将IE10切换到IE8标准渲染模式时,以下语法有效: <!--[if IE]><!--> <link href="@Url.Content("~/Content/global/global.ie.css")" rel="stylesheet" type="text/css"> <!--<![endif]--> 而这

在IE10中调试我的ASP.NETMVC(基于Razor的)网站时,我仍然需要设置特定于IE的css。使用IE条件注释时,将IE10切换到IE8标准渲染模式时,以下语法有效:

<!--[if IE]><!--> 
<link href="@Url.Content("~/Content/global/global.ie.css")" rel="stylesheet" type="text/css">
<!--<![endif]-->

而这——并不是:

<!--[if IE]> 
<link href="@Url.Content("~/Content/global/global.ie.css")" rel="stylesheet" type="text/css">
<![endif]-->

后面的语法在大多数提供有条件评论信息的网站上作为示例给出,包括MSDN的官方页面。这两者有什么区别?提前谢谢。

使用“下层显示条件评论”使其正常工作

语法:

…声明。。。
例子:

更多信息: 某些验证服务将下层显示的条件注释语法标记为无效HTML。可以在要显示的HTML内容之前和之后添加其他字符以构造有效的HTML注释

<!--[if !IE]>--> 
    YOUR HTML 
<!--<![endif]-->

你的HTML
在上面的示例中,负条件表达式阻止Internet Explorer在下层显示的条件注释块中显示HTML内容。但是,如果条件表达式的计算结果为true,则第一条注释的结尾“->”将与Internet Explorer中的HTML内容一起出现。要对Internet Explorer用户隐藏这些字符,请添加“
<!--[if !IE]><!--> 
    YOUR HTML 
<!--<![endif]-->

你的HTML
示例: 下面是更多的条件注释示例

<!--[if IE]><p>You are using Internet Explorer.</p><![endif]-->
<![if !IE]><p>You are not using Internet Explorer.</p><![endif]>

<!--[if IE 7]><p>Welcome to Internet Explorer 7!</p><![endif]-->
<!--[if !(IE 7)]><p>You are not using version 7.</p><![endif]-->

<!--[if gte IE 7]><p>You are using IE 7 or greater.</p><![endif]-->
<!--[if (IE 5)]><p>You are using IE 5 (any version).</p><![endif]-->
<!--[if (gte IE 5.5)&(lt IE 7)]><p>You are using IE 5.5 or IE 6.</p><![endif]-->
<!--[if lt IE 5.5]><p>Please upgrade your version of Internet Explorer.</p><![endif]-->

<!--[if true]>You are using an <em>uplevel</em> browser.<![endif]-->
<![if false]>You are using a <em>downlevel</em> browser.<![endif]>

<!--[if true]><![if IE 7]><p>This nested comment is displayed in IE 7.</p><![endif]><![endif]-->

您没有使用Internet Explorer

您正在使用下层浏览器。

内容取自

哦,为什么?IE 10修复(不支持)条件注释..:-/(虽然在IE9或之前的文档模式下运行时它应该支持条件注释)。如何将其与asp append version=“true”标记帮助器结合?
<!--[if !IE]><!--> 
    YOUR HTML 
<!--<![endif]-->
<!--[if IE]><p>You are using Internet Explorer.</p><![endif]-->
<![if !IE]><p>You are not using Internet Explorer.</p><![endif]>

<!--[if IE 7]><p>Welcome to Internet Explorer 7!</p><![endif]-->
<!--[if !(IE 7)]><p>You are not using version 7.</p><![endif]-->

<!--[if gte IE 7]><p>You are using IE 7 or greater.</p><![endif]-->
<!--[if (IE 5)]><p>You are using IE 5 (any version).</p><![endif]-->
<!--[if (gte IE 5.5)&(lt IE 7)]><p>You are using IE 5.5 or IE 6.</p><![endif]-->
<!--[if lt IE 5.5]><p>Please upgrade your version of Internet Explorer.</p><![endif]-->

<!--[if true]>You are using an <em>uplevel</em> browser.<![endif]-->
<![if false]>You are using a <em>downlevel</em> browser.<![endif]>

<!--[if true]><![if IE 7]><p>This nested comment is displayed in IE 7.</p><![endif]><![endif]-->