我想定位鏈接類的最後一項。通過這個,我的意思是每個項目可能有一個entry
類,並且如果兩個主要項目具有相同的「入口」類別,則它將變爲鏈接。選擇鏈接類的最後一項?
我該怎麼做?
<ul class="date">
<li class="entry"></li>
<li></li>
<li class="entry"></li>
<li class="entry"></li>
<li class="entry"></li> /* target this item */
<li></li>
<li class="entry"></li>
<li class="entry"></li> /* target this item */
<li></li>
</ul>
/* targets all chained classes */
.entry + .entry { }
/* targets first of a chained class */
:not(.entry) + .entry { }
會不會有永遠是'
'你想指定的應用程式後? – Barmar是的,會有。 – ditto
請注意,':not(.entry)+ .entry {}'不一定針對「鏈接類的第一個」,因爲它也會針對該類的「單獨條目」(非鏈接),即_not該組的第一個孩子。 – ScottS