【问题标题】:IE11 Conditional CSS Comment does not workIE11 条件 CSS 注释不起作用
【发布时间】:2017-01-21 06:46:31
【问题描述】:

我尝试了几种在不同网站上看到的条件格式,但似乎无法让它发挥作用。浏览器版本为 IE 11。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title></title>
<link href="CSS/reset.css" rel="stylesheet" />
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="CSS/font-awesome.css" rel="stylesheet" />
<!--[if !IE]><!--><link rel="stylesheet" type="text/css" href="CSS/login.css" /><!--<![endif]-->
<!--[if IE]><!--><link rel="stylesheet" type="text/css" href="CSS/loginIE.css" /><!--<![endif]-->

我已经更改了格式。删除 Bootstrap 和 Fontawesome CSS 但仍然无法正常工作。我什至更改/删除了文档类型和元值,但没有任何效果。请帮忙。

【问题讨论】:

    标签: html css internet-explorer internet-explorer-11 conditional-comments


    【解决方案1】:

    IE10+没有Conditional cmets,看看here

    已在 Internet Explorer 中删除对条件 cmets 的支持 10 种标准和怪癖模式,用于提高互操作性和 符合 HTML5。这意味着条件注释现在是 被视为常规 cmets,就像在其他浏览器中一样。这种变化 可能会影响专门为 Windows Internet Explorer 编写的页面或 使用浏览器嗅探来改变其在 Internet 中的行为的页面 探险家。

    您可以尝试对 IE10 和 IE11 使用 IE hacks

    类似这样的:

    /*IE10 and IE11*/
    
    @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
        .selector { property:value; }
    }
    

    【讨论】:

    • 哦!我应该用谷歌搜索 IE11 浏览器 cmets。非常感谢!
    • 没问题 :) 查看更新的答案以获得可能的解决方案;)
    • 刚刚做到了。它只是说我必须等待10分钟才能选择它作为问题的答案。再次感谢!
    【解决方案2】:

    Conditional comments are no longer supported after IE10:

    已在 Internet Explorer 10 标准和怪癖模式中删除了对条件 cmets 的支持,以提高互操作性和与 HTML5 的合规性。

    【讨论】:

      猜你喜欢
      • 2012-05-07
      • 1970-01-01
      • 2014-10-08
      • 2014-04-02
      • 2012-01-25
      • 1970-01-01
      • 2012-02-16
      • 2013-01-22
      • 1970-01-01
      相关资源
      最近更新 更多