[英]Conditional comments for CSS in IE9
I want to add a specific style sheet for IE9 which overrides the img.icon css class with different margin values. 我想为IE9添加一个特定的样式表,它覆盖了具有不同边距值的img.icon css类。 So i add the below in the head section.
所以我在头部添加以下内容。 But when page loads it display as a text in browser.
但是当页面加载时,它会在浏览器中显示为文本。
<!--[if IE 9]>
img.icon {
float: right;
margin: 4px -31px;
}
<![endif]-->
You are missing the <style>
tags 您缺少
<style>
标签
<!--[if IE 9]>
<style>
img.icon {
float: right;
margin: 4px -31px;
}
</style>
<![endif]-->
<!--[if IE9]>
<style>
img.icon {
float: right;
margin: 4px -31px;
}
</style>
<![endif]-->
it think 它认为
You forgot the style tags. 你忘记了样式标签。
<!--[if IE 9]>
<style>
img.icon {
float: right;
margin: 4px -31px;
}
</style>
<![endif]-->
Also, you might find it easier to load an external stylesheet within the conditional comments: 此外,您可能会发现在条件注释中加载外部样式表更容易:
<!--[if IE 9]>
<link rel="stylesheet" href="css/ie9.css">
<![endif]-->
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.