【发布时间】:2013-05-28 05:25:02
【问题描述】:
我无法让 :nth-child 选择器与 IE7/8 一起使用。
Here is 我的代码的工作示例(适用于 Chrome)
下面是我使用的 CSS 和 HTML:
CSS:
#price-list {
width:98%;
padding:1%;
border:white 1px solid;
margin:0 auto;
overflow:hidden;
}
#price-list h4 {
padding-top:20px;
font-weight:400;
padding-bottom:5px;
}
#price-list ul {
width:100%;
margin-bottom:10px;
overflow:hidden;
}
#price-list li{
line-height:1.5em;
border-bottom:1px dashed #C9F;
float:left;
display:inline;
padding-top:5px;
padding-bottom:5px;
text-align:center;
}
#price-list li strong {
color:#C9F;
font-weight:normal;
}
#double-taxi li:nth-child(odd) {
width:80%;
text-align:left;
}
#double-taxi li:nth-child(even) {
width:20%;
}
HTML:
<div id="price-list">
<ul id="double-taxi">
<li><h4>North Goa</h4><strong>(Distance kms)</strong></li><li><h4>Non A/C</h4>Rs <strong>(UK £)</strong></li>
<li>Aldona <strong>(10 kms)</strong></li><li>250 Rs <strong> (£3)</strong></li>
<li>Asnora <strong>(15 kms)</strong></li><li>250 Rs <strong> (£3)</strong></li>
<li>Bicholim <strong>(21 kms)</strong></li><li>420 Rs <strong> (£5)</strong></li>
<li>Camurlim <strong>(10 kms)</strong></li><li>250 Rs <strong> (£3)</strong></li>
<li>Colvale <strong>(10 kms)</strong></li><li>250 Rs <strong> (£3)</strong></li>
</ul>
We DO NOT provide a taxi service. The Exchange Rate used to calculate UKP was 80Rs to the UKP and was rounded up to whole pound.
</div>
任何帮助将不胜感激。
【问题讨论】:
-
你没有做错任何事——IE7和IE8不支持。你需要使用 JS 来适应它,或者接受旧版本的浏览器看起来不如新版本的浏览器那么华丽。
-
这是一个 CSS3 规则,IE9 之前不支持
标签: internet-explorer css css-selectors