The nth-child
selector counts siblings (i.e., elements having the same parent).
In your HTML structure, div.social-logo
is always the first, last and only child of a
. So nth-child
has only one element to count.
However, there are multiple anchor elements, all of which are siblings (children of #social-links
), so nth-child
can target each one.
#social-links a:nth-child(1) div
#social-links a:nth-child(2) div
#social-links a:nth-child(3) div
.
.
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…