JSFiddle - React, Tailwind, and code Playground
by Vishnuprasad ps
HTML
<div class="card">
<div class="percent">
<svg>
<circle cx="105" cy="105" r="100"></circle>
<circle cx="105" cy="105" r="100" style="--percent: 12"></circle>
</svg>
<div class="number">
<h3>40<span>%</span></h3>
</div>
</div>
</div>
SCSS
body {
font-family: 'Montserrat', sans-sherif;
background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
background-repeat: no-repeat;
height: 100vh;
color: #555555;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.card {
}
.card .percent {
position: relative;
}
.card svg {
position: relative;
width: 210px;
height: 210px;
transform: rotate(-90deg);
}
.card svg circle {
width: 100%;
height: 100%;
fill: none;
stroke: #585858;
stroke-width: 10;
stroke-linecap: round;
}
.card svg circle:last-of-type {
stroke-dasharray: 625px;
stroke-dashoffset: calc(625px - (625px * var(--percent)) / 100);
stroke: #3498db;
}
.card .number {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.card .number h3 {
font-weight: 200;
font-size: 3.5rem;
}
.card .number h3 span {
font-size: 2rem;
}
.card .title h2 {
margin: 25px 0 0;
}
.card:nth-child(1) svg circle:last-of-type {
stroke: #f39c12;
}
.card:nth-child(2) svg circle:last-of-type {
stroke: #2ecc71;
}