I need to create rating stars in css, I have two requirements so far,
- Half colored star.
- Star with border but Body transparent.
So far I was able to create a fully colored stars using CSS. But with this structure I am unable to achieve the above requirements.
This is what I have now, I followed this ANSWER for my reference
.star {
position: relative;
display: inline-block;
width: 0;
height: 0;
margin-left: .9em;
margin-right: .9em;
margin-bottom: 1.2em;
border-right: .3em solid transparent;
border-bottom: .7em solid #FC0;
border-left: .3em solid transparent;
/* Controlls the size of the stars. */
font-size: 24px;
}
.star:before,
.star:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
top: .6em;
left: -1em;
border-right: 1em solid transparent;
border-bottom: .7em solid #FC0;
border-left: 1em solid transparent;
transform: rotate(-35deg);
}
.star:after {
transform: rotate(35deg);
}
<p>
<i class="star"></i>
<i class="star half"></i>
<i class="star transparent"></i>
</p>