This is just a problem with the CSS selector being used. These don't match the buttons:
.app-btn:after:nth-child(1) { ... }
.app-btn:after:nth-child(2) { ... }
In fact, each button is a sole child of the parent div
so that selector doesn't actually make sense.
Instead, use the nth-child
on the parent div (or, potentially, nth-of-type
) and then apply the style to the descendent app-btn
:
.app:nth-child(1) > .app-btn:after { ... }
.app:nth-child(2) > .app-btn:after { ... }
The following snippet shows this in action:
.app > .app-btn {
font-size: 0px !important;
}
.app > .app-btn:after {
content: '+2500';
visibility: visible;
font-size: 15px !important;
}
.app:nth-child(1) > .app-btn:after {
content: "+18000";
}
.app:nth-child(2) > .app-btn:after {
content: "+14000";
}
<div class="app" data-url="#">
<button class="app-btn">CHANGE</button>
</div>
<div class="app" data-url="#">
<button class="app-btn">CHANGE</button>
</div>
<div class="app" data-url="#">
<button class="app-btn">CHANGE</button>
</div>