'circle progress bar css
I want to create a circle bar which stroke will be getting thicker as it progress.
Is it possible using css, or svg which can run on ionic mobile app.
Here is the what I want to achieve :
and here is fiddle for starting point :
.wrap {
background: #0b1626;
padding: 2em;
color: #FFF;
font-family: 'Arial Black';
}
.knob {
position: relative;
margin: 0 auto;
padding: 1.5em;
width: 220px;
height: 220px;
border-radius: 50%;
border: 1px solid #e84d51;
}
.knob .val {
padding-top: 1em;
font-size: 28px;
text-align: center;
}
<div class="wrap">
<div class="knob">
<div class="stats">
<p class="val">16,858<br>1,285</p>
</div>
</div>
</div>
Solution 1:[1]
Try to use this line of code for progress bar
@keyframes growProgressBar {
0%, 33% { --pgPercentage: 0; }
100% { --pgPercentage: var(--value); }
}
@property --pgPercentage {
syntax: '<number>';
inherits: false;
initial-value: 0;
}
div[role="progressbar"] {
--size: 12rem;
--fg: #f00;
--bg: #def;
--pgPercentage: var(--value);
animation: growProgressBar 3s 1 forwards;
width: var(--size);
height: var(--size);
border-radius: 50%;
display: grid;
place-items: center;
background:
radial-gradient(closest-side, white 80%, transparent 0 99.9%, white 0),
conic-gradient(var(--fg) calc(var(--pgPercentage) * 10%), var(--bg) 0)
;
font-family: Helvetica, Arial, sans-serif;
font-size: calc(var(--size) / 5);
color: var(--fg);
}
div[role="progressbar"]::before {
counter-reset: percentage var(--value);
content: counter(percentage) '/10';
}
/* demo */
body {
margin: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
<div role="progressbar" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" style="--value:8"></div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Masud Rana |

