asp.net – IE10条件IE注释<! - >功能启用程序
发布时间:2020-12-16 09:24:02 所属栏目:asp.Net 来源:网络整理
导读:在IE10中调试我的ASP.NET MVC(基于Razor的)网站时,我还需要设置IE特定的css.使用IE条件注释时,在将IE10切换到IE8标准渲染模式时,以下语法有效: !--[if IE]!-- link href="@Url.Content("~/Content/global/global.ie.css")" rel="stylesheet" type="text/css
在IE10中调试我的ASP.NET MVC(基于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上的官方页面.这两者有什么区别?先感谢您. 解决方法
使用“Downlevel-revealed Conditional Comments”让它运作起来……
句法: <![if IE]> ...statements... <![endif]> 例: <![if IE]> <link href="@Url.Content("~/Content/global/global.ie.css")" rel="stylesheet" type="text/css"> <![endif]> 更多信息: 某些验证服务将下层显示的条件注释语法标记为无效HTML.可以添加其他字符以在要显示的HTML内容之前和之后构造有效的HTML注释. <!--[if !IE]>--> YOUR HTML <!--<![endif]--> 在上面的示例中,负条件表达式阻止Internet Explorer在下层显示的条件注释块中显示HTML内容.但是,如果条件表达式的计算结果为true,则结束“ – >”第一条评论与Internet Explorer中的HTML内容一起出现.要从Internet Explorer用户隐藏这些字符,请添加“ <!--[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]--> 内容取自Valid HTML for downlevel-revealed conditional comments (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – web.config使用规则将非www或非https重定向到ht
- 通过Asp.net中Button的CommandArgument传递多个参数
- asp.net-mvc-4 – Web.API和FromBody
- asp.net – DataBinding:’System.Data.DataRowView’不包
- 使用ASP.NET Identity 2.0和MVC 5进行自定义单点登录
- asp.net-mvc – 建立一个在MVC路由之上做出反应的SPA
- asp.net – 处理原始HTTP请求内容
- ASP.NET Profiles版本控制?
- 合并两个ASP.NET成员资格数据库
- asp.net-mvc – 如何修复System.Net.Sockets.SocketExcepti