JSFiddle - React, Tailwind, and code Playground

by Alexander

HTML

<div class="b-rating m-green c-train_rating">
    <span class="active">★</span>
    <span class="active">★</span>
    <span class="active">★</span>
    <span>★</span>
    <span>★</span>
</div>

CSS

body {
    margin: 20px;
}

.b-rating {
    unicode-bidi: bidi-override;
    text-align: center;
}

 .b-rating > span {
    display: inline-block;
    position: relative;
}

.b-rating span.active {
    color: transparent;
}

.b-rating span.active:before {
    content: "\2605";
    position: absolute;
    left: 0;
}

.b-rating.m-gray span.active:before {
    color: gray;
}

.b-rating.m-green span.active:before {
    color: green;
}

.c-train_rating {
    color: #ccc;
}