这里使用到nth-child()
选择器
例一:
父元素的第二个子元素的每个 p 的背景色:
p:nth-child(2)
{
background:#ff0000;
}
例二:
选中第二个 th
<style type = "text/css">
table tr th:nth-child(2)
</style>
<table>
<tr>
<th>第一个</th>
<th>第二个</th>
<th>第三个</th>
</tr>
</table>
使用:
分别设置summary-li
下三个span
的样式
.summary-li:not(:first-child) span:nth-child(1) {
width: 90px;
}
.summary-li:not(:first-child) span:nth-child(2) {
width: 50px;
margin-left: 45px;
}
.summary-li:not(:first-child) span:nth-child(3) {
margin-left: 60px;
}