我有一个包含 10 个选择器定义的样式表。当我在 IE 和 Chrome 中查看我的网站时(我不包括 FF,因为它的呈现方式与它在 Chrome 中的呈现方式完全一样),十个选择器定义中有九个在所有浏览器中都一致地工作。
不起作用的定义如下:
a.dp-choose-date
{
/* border: 1px solid red; */
float: right;
width: 25px;
height: 25px;
padding-top: 5px;
padding-left: 16px;
position: relative; /* This is only needed for IE */
top: -25px; /* This is only needed for IE */
margin: 0px;
display: block;
text-indent: -2000px;
overflow: hidden;
background: url(../images/calendar3.png) no-repeat;
}
如您所见,IE 只需要两个值。所以我对条件CSS做了一些研究。我现在已经使用了我的样式表并使用 IE 的两个附加条目创建了一个副本。
在我的文档顶部,我现在有以下内容:
<!--[if IE]>
<link href="Styles/custom.css" rel="stylesheet" type="text/css" />
<![endif]-->
<![if !IE]>
<link href="Styles/Site.css" rel="stylesheet" type="text/css" />
<![endif]>
哪个有效,但我不能在选择器级别执行条件语句吗?
我也在 CSS 文档中尝试过,但也没有用。
[if IE] a.dp-choose-date {
/* definitions here */
}
有没有人有什么建议?