Reputation: 67
I'm trying to target each span individually in a structure like below. I've tried nth-child()
& nth-of-type()
but it didn't work, it was only applying the first style to all of the spans. Anyone no know how to do this without giving each a separate IDs?
<div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
<div>
<span></span>
</div>
</div>
Upvotes: 2
Views: 440
Reputation: 3144
try this
div > div:nth-of-type(n) > span {
}
where (n)
will be number of the div
Upvotes: 2