CSS Master

(Primo) #1
Figure 1.35. Using An+B syntax to select every third element

Here’swheremattersbecomealittlemoreinteresting.Wecanuse:nth-child()
and:nth-last-child()toselectallelementsafteracertainpoint.Let’stryselecting
allbutthefirstsevenelements:


.item:nth-child(n+8) {
background: #e91e63;
}

Here,thereisnostepvalue.Asaresult,n+8matcheseveryelementnbeginning
withtheeighthelement,asshowninFigure1.36.


Selectors 53

Free download pdf