我知道你可以用:last-child
來選擇最後的寒意。現在我需要選擇最後3個孩子的唯一的問題是孩子的量是不知道,所以我不能使用:nth-child
,我知道有個東西叫:nth-last-child
但我真的不能明白這是怎麼工作的選擇最後3個孩子
<div id="something">
<a href="images/x.jpg" ><a/>
<a href="images/x.jpg" ><a/>
<!-- here some more
and than i need to select these -->
<a href="images/x.jpg" ><a/>
<a href="images/x.jpg" ><a/>
<a href="images/x.jpg" ><a/>
</div>
所以現在我需要一些這樣的事:
#something a:last-child{
/* only now it needs to select 2 more a's that are before this child */
}
':第n-最後child',基本相同':第n-child'但數從去年到第一AFAIK。 –
現在的問題是需要選擇最後3個 – Ivo
P.S.結束標籤是'