JSFiddle - React, Tailwind, and code Playground
HTML
<span class="star-icon full">☆</span>
<span class="star-icon full">☆</span>
<span class="star-icon full">☆</span>
<span class="star-icon half">☆</span>
<span class="star-icon">☆</span>
CSS
.star-icon {
color: #ddd;
font-size: 2em;
position: relative;
}
.star-icon.full:before {
text-shadow: 0 0 2px rgba(0,0,0,0.7);
color: #FDE16D;
content: '\2605'; /* Full star in UTF-8 */
position: absolute;
left: 0;
}
.star-icon.half:before {
text-shadow: 0 0 2px rgba(0,0,0,0.7);
color: #FDE16D;
content: '\2605'; /* Full star in UTF-8 */
position: absolute;
left: 0;
width: 50%;
overflow: hidden;
}
@-moz-document url-prefix() { /* Firefox Hack :( */
.star-icon {
font-size: 50px;
line-height: 34px;
}
}
JavaScript
// no js required