Pure CSS Radial Graph
How do I make an pure css radial graph?
This is simple, animatable circle graph/progress meter made with pure CSS. Animations are included using CSS transitions on the rotation values of the fill elements.. What is a pure css radial graph? How do you make a pure css radial graph? This script and codes were developed by Christian Naths on 29 November 2022, Tuesday.
Pure CSS Radial Graph - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure CSS Radial Graph</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="radial-graph"> <div class="shape"> <div class="mask full-mask"> <div class="fill"></div> </div> <div class="mask"> <div class="fill"></div> <div class="fill shim"></div> </div> </div> <div class="cutout"> </div>
</div>
</body>
</html>
Pure CSS Radial Graph - Script Codes CSS Codes
/* just some container styles */
body, html { height: 100%; }
body { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; }
/* Radial Graph Settings - size: .radial-graph, .shape, .mask, and .fill will all need to receive the same width & height properties. Then .mask and .fill need to have their clip property set accordingly. - width: The stroke width is made by just placing a "cutout" shape on top, and can be sized and positioned as you like (or removed). - progress: adjust the .fill.shim rotation to a percentage of the total radius, and then the .mask.full-mask & .fill rotations to a value of half of that. See inline comments below for the formulas.
*/
.radial-graph,
.shape,
.mask,
.fill { width: 220px; height: 220px; border-radius: 50%;
}
.shape,
.mask,
.fill { position: absolute; background-color: #ebeff1;
}
.mask,
.fill { -webkit-backface-visibility: hidden; -webkit-transition: -webkit-transform 1s; transition: -webkit-transform 1s; transition: transform 1s; transition: transform 1s, -webkit-transform 1s; border-radius: 50%;
}
.mask { clip: rect(0px, 220px, 220px, 110px);
}
.fill { clip: rect(0px, 110px, 220px, 0px); background-color: #50e3c2;
}
.cutout { margin-left: 15px; margin-top: 15px; width: 190px; height: 190px; position: absolute; background-color: white; border-radius: 50%;
}
.mask.full-mask,
.fill { /* For a value of 90% 0.9 * 360 / 2 */ -webkit-transform: rotate(162deg); transform: rotate(162deg);
}
.fill.shim { /* For a value of 90% 0.9 * 360 */ -webkit-transform: rotate(324deg); transform: rotate(324deg);
}
.start .mask.full-mask,
.start .fill { /* For a value of 40% 0.4 * 360 / 2 */ -webkit-transform: rotate(0deg); transform: rotate(0deg);
}
.start .fill.shim { /* For a value of 40% 0.4 * 360 */ -webkit-transform: rotate(0deg); transform: rotate(0deg);
}
.end .mask.full-mask,
.end .fill { /* For a value of 81% 0.81 * 360 / 2 */ -webkit-transform: rotate(145.8deg); transform: rotate(145.8deg);
}
.end .fill.shim { /* For a value of 81% 0.81 * 360 */ -webkit-transform: rotate(291.6deg); transform: rotate(291.6deg);
}
Developer | Christian Naths |
Username | christiannaths |
Uploaded | November 29, 2022 |
Rating | 3 |
Size | 2,363 Kb |
Views | 12,144 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Activity Timeline | 5,624 Kb |
Animated Open Mentorship Logo | 2,710 Kb |
Responsive App Layout | 5,661 Kb |
Collection-bootstrap | 2,843 Kb |
Responsive Admin Panel | 4,254 Kb |
A Pen by Christian Naths | 2,563 Kb |
Animated Chart | 5,214 Kb |
MicroHero Logo Animation | 5,290 Kb |
Off-Canvas Responsive Layout | 52,985 Kb |
CSS-Only Inputs | 4,678 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Fluid Layout with Float | Jxqr97 | 1,785 Kb |
A Pen by Final Boss tommyb9 | FBtommyb9 | 55,354 Kb |
Countdown Timer | Massiebn | 3,001 Kb |
JavaScript constructors | Simboonlong | 2,415 Kb |
A Pen by James Podles | Jpod | 2,656 Kb |
Slider css only | Armandobau | 2,161 Kb |
3D Text in Sass | Bookcasey | 2,766 Kb |
Plotting Points with D3.js | Laurakelly | 31,996 Kb |
Hello People | Danburrows | 2,365 Kb |
Colorful Sliders | Chanrith | 1,246 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!