简体   繁体   English

IE的条件评论不起作用

[英]Conditional comments for IE not working

I'm trying to include an IE7-only stylesheet using a conditional comment: 我正在尝试使用条件注释包含仅限IE7的样式表:

<head>
  <meta charset="utf-8">
  <title>Title</title>
  <meta name="description" content="Description">
  <link href="/static/styles/bootstrap.min.css" rel="stylesheet">
  <link href="/static/styles/font-awesome.min.css" rel="stylesheet">
  <link href="/static/styles/main.css" rel="stylesheet">
  <link href='//fonts.googleapis.com/css?family=Quicksand:700' rel='stylesheet' type='text/css'>
  <!--[if lt IE 9]>
    <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
  <!-- [if IE 7]>
    <link type="text/css" rel="stylesheet" href="/static/styles/ie7.css">
  <![endif]-->
  <link rel="icon" type="image/png" href="/static/images/layout/favicon.png">
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>

I have a Windows 7 virtual machine (running on VirtualBox) and I'm using the developer's tools in IE9 to switch the browser mode to IE7. 我有一个Windows 7虚拟机(在VirtualBox上运行),我正在使用IE9中的开发人员工具将浏览器模式切换到IE7。 Nothing in the referenced stylesheet is applied to the page. 引用的样式表中没有任何内容应用于页面。 I'm loading this stylesheet after all others, I'm using !important on everything, and I've triple-checked the file name and path, but the styles are still not being applied. 我正在加载这个样式表,我正在使用!important对所有内容都很!important ,我已经对文件名和路径进行了三重检查,但样式仍未应用。 Can anyone see where I've gone wrong? 谁能看到我出错的地方?

there is a space 有一个空间

<!--RIGHT HERE[... remove that one

before: 之前:

<!-- [if IE 7]>
    <link type="text/css" rel="stylesheet" href="/static/styles/ie7.css">
 <![endif]-->

after: 后:

 <!--[if IE 7]>
    <link type="text/css" rel="stylesheet" href="/static/styles/ie7.css">
  <![endif]-->

not sure if thats it though 不确定是不是这样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM