Created
March 18, 2024 10:22
-
-
Save a2sc/aad6c311bed2a7547868ce534545ee85 to your computer and use it in GitHub Desktop.
CSS-Only Radial Progress Bars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>CSS-Only Radial Progress Bars/title> | |
<style> | |
.progress { | |
width: 100px; | |
height: 100px; | |
padding: 3px; | |
border-radius: 50%; | |
display: flex; | |
background: conic-gradient(var(--outline, black) calc(var(--progress, 1) * 1%), transparent 0%); | |
} | |
.progress .value { | |
width: 100%; | |
height: 100%; | |
margin: auto; | |
border-radius: 50%; | |
background: #e5e5e5; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
font-family: sans-serif; | |
color: black; | |
font-size: 2.5rem; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="progress" style="--outline: red; --progress: 18"> | |
<div class="value">18</div> | |
</div> | |
<div class="progress" style="--outline: green; --progress: 85"> | |
<div class="value">85</div> | |
</div> | |
</body> | |
</html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment