Reputation: 11
I am trying to get an h2 element with a specific class name inside divs with the same class name except the first one. here is the structure:
<div class="rank-content">
<h2 class="rank-badge">test</h2>
</div>
<div class="rank-content">
<h2 class="rank-badge">test</h2>
</div>
<div class="rank-content">
<h2 class="rank-badge">test</h2>
</div>
I am trying to change css appearance of all rank badge except from the the first .ranked-content. I've tried this one but it changes all rank-badge h2:
.ranking-content:not(:first-child) .rank-badge {
}
.ranking-content:not(:nth-child(1)) .rank-badge {
}
any ideas? thanks in advance.
Upvotes: 0
Views: 311
Reputation: 1104
You are calling .ranking-content
and that isn't the name of the class you have in your HTML.
The name in the class attribute is rank-content
.
This is how you should call it in your CSS.
.rank-content:not(:first-child) .rank-badge {
}
Upvotes: 1
Reputation: 11
You can also try this.
.rank-content:not(:first-of-type) .rank-badge {
}
Upvotes: 0
Reputation: 11
Have you attempted to create a unique class variant for your first rank-badge
class such as rank-badge 2
?
Upvotes: 0