I tried implementing several guides to creating a circle which fills according to a percentage but i can't seem to get it to work (no animation, only a static CSS circle).
The circle border currently abides to background-image: linear-gradient
which i first set to a (90+(360*0.percent))deg
and a second one which is set to 90deg
. It works well on the first 50% but beyond that it doesn't fill accordingly.
.circle {
position: relative;
top: 5px;
left: 5px;
text-align: center;
width: 100px;
height: 100px;
border-radius: 100%;
background-color: #ffffff;
}
.circle-border {
position: relative;
text-align: center;
width: 110px;
height: 110px;
margin-left: 30%;
border-radius: 100%;
background-color: #E53B3B;
background-image: linear-gradient(162deg, transparent 50%, #f0f0f0 50%), linear-gradient(90deg, #f0f0f0 50%, transparent 50%);
}
<div class="circle-border">
<div class="circle">
</div>
</div>
What values of linear-gradient
should be changed when i want the circle to be filled for more than 50%?