I am having problems with CSS pseudo selectors ::after
and ::before
.
.moneygold {
padding-right: 15px;
}
.moneygold:after {
content: "";
display: block;
background: url(https://i.ibb.co/QDtRsY4/money-gold.gif) no-repeat;
width: 13px;
height: 13px;
float: left;
margin: 6px 0 0 1px;
}
.moneysilver {
padding-right: 15px;
}
.moneysilver:after {
content: "";
display: block;
background: url(https://i.ibb.co/mRDQpvD/money-silver.gif) no-repeat;
width: 13px;
height: 13px;
float: left;
margin: 6px 0 0 1px;
}
.moneycopper {
padding-right: 15px;
}
.moneycopper:after {
content: "";
display: block;
background: url(https://i.ibb.co/KGSzwYh/money-copper.gif) no-repeat;
width: 13px;
height: 13px;
float: left;
margin: 6px 0 0 1px;
}
<span class="moneygold">3</span>
<span class="moneysilver">17</span>
<span class="moneycopper">20</span>
I want the icons to show after each of the corresponding spans, but for some reason they all show before the first span . I have also observed the same behavior with using ::before
instead of ::after
.
What am I doing wrong?