【发布时间】:2012-09-20 11:54:10
【问题描述】:
当使用带有 !important 的 IE 条件(例如下面的代码)时,无论浏览器如何,背景都默认为带有 !important 的背景色 即使在 IE 中有条件的。
如何重写这一点,以便浏览器接受小于 IE9 的背景颜色和 IE9 和其他浏览器中的图像(高度/宽度:100%,无重复)?
注意:我计划在默认情况下主题自动设置颜色或图像的 Wordpress 网站中使用它,因此我必须使用 !important 来覆盖默认主题样式。
body {
<!--[if lt IE 9]>
background-color:#c1beb2 !important;
background:#c1beb2 !important;
<![endif]-->
<!--[if gte IE 9]>
background-image: url("http://example.com/wp-content/example.png") !important;
background-position:left bottom;
background-size: 100% 100%;
background-repeat: no-repeat;
<![endif]-->
<![if !IE]>
background-image: url("http://example.com/wp-content/example.png") !important;
background-position:left bottom;
background-size: 100% 100%;
background-repeat: no-repeat;
<![endif]>
}
【问题讨论】:
-
你能整理出一个 jsfiddle 让我们试试看吗?
-
那是...不是您使用 IE 条件的方式...
标签: html css internet-explorer cross-browser