这是一个非常简单的HTML页面,我正在尝试在IE 11上呈现该页面,但是以某种方式却从未使用过IE特定的CSS文件。
我将代码附加在这里。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="images/favicon.ico">
<title>Demo</title>
<!-- Custom styles for this template -->
<link href="css/style.css" rel="stylesheet">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/all-ie-only.css" />
<![endif]-->
</head>
<body class="subpage">
</body>
</html>
我的CSS包含:
style.css
body{background:blue;}
all-ie-only.css
body{background:red;}
注意: 我已经从以下类似问题中引用并尝试了解决方案,但是没有运气。
ie only stylesheet not working, code included
我没有运气尝试过的解决方案:
<script>
/*@cc_on
@if (@_jscript_version == 11)
document.write("You are using IE11 with an older document mode");
@elif (@_jscript_version == 10)
document.write("You are using IE10");
@elif (@_jscript_version == 9)
document.write("You are using IE9");
@elif (@_jscript_version == 5.8)
document.write("You are using IE8");
@elif (@_jscript_version == 5.7 && window.XMLHttpRequest)
document.write("You are using IE7");
@elif (@_jscript_version == 5.6 || (@_jscript_version == 5.7 && !window.XMLHttpRequest))
document.write("You are using IE6");
@elif (@_jscript_version == 5.5)
document.write("You are using IE5.5");
@elif (@_jscript_version < 5.5)
document.write("You are using a version older than IE5.5");
@else
document.write("You are using an unknown version of IE");
@end
@*/
</script>
我尝试过的方法如下:https://en.wikipedia.org/wiki/Conditional_comment
似乎,如果条件指定了“ @_jscript_version”,它就永远不会进入。任何帮助都表示赞赏。
答案 0 :(得分:3)
IE10和IE11不支持条件注释。
在IE10和IE11中不再支持条件注释。