:last-child
私はあなたが最後の子供または特定の子供を選択できることを知っています:nth-child
(あなたが彼らの位置/番号を知っている場合)。
必要なのは、子要素がいくつあるかを知らずに、最後の3つの子を選択することです。
呼ばれるものがあることは知っていますが:nth-last-child
、それがどのように機能しているかを本当に理解することはできません。
このため:
<div id="something">
<a href="images/x.jpg" ><a/>
<a href="images/x.jpg" ><a/>
<!-- More elements here -->
<!-- ..... -->
<!-- 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 selects the last <a> and the 2 <a>'s that come before*/
}