html - IE11 条件 CSS 注释不起作用

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

我已经尝试了在不同网站上看到的几种条件格式,但似乎无法让它发挥作用。浏览器版本为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 但仍然无法正常工作。我什至更改/删除了文档类型和元值,但没有任何效果。请帮忙。

最佳答案

IE10+没有条件注释,看看here

Support for conditional comments has been removed in Internet Explorer 10 standards and quirks modes for improved interoperability and compliance with HTML5. This means that Conditional Comments are now treated as regular comments, just like in other browsers. This change can impact pages written exclusively for Windows Internet Explorer or pages that use browser sniffing to alter their behavior in Internet Explorer.

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

像这样:

/*IE10 and IE11*/

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

关于html - IE11 条件 CSS 注释不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39473879/

相关文章:

html - 在 WebSlides 中嵌入 Bokeh 时工具栏未对齐

css - 在 React Native 中将 View 置于其他 View 之上

css - Internet Explorer 负边距裁剪 div

javascript - 访问 JQuery 中的两个不同按钮

javascript - 使用 JavaScript 更改输入框

android - 2015 年大多数设备上的最佳屏幕分辨率页面宽度 1200px

html - 以下的 Vim 快捷方式或插件

html - 在二级菜单的顶部带一个向上箭头?

internet-explorer - spring AbstractExcelView 和 IE

javascript - 为什么 IE11 在 onkeyup 中设置文本框值时按 Ctrl+Z 时会重复内容?