CSS Donut Charts

Developer
Size
2,908 Kb
Views
28,336

How do I make an css donut charts?

What is a css donut charts? How do you make a css donut charts? This script and codes were developed by Sean Stopnik on 21 December 2022, Wednesday.

CSS Donut Charts Previews

CSS Donut Charts - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Donut Charts</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="card"> <div class="donut-chart chart1"> <div class="slice one"></div> <div class="slice two"></div> <div class="chart-center"> <span></span> </div> </div>
</div>
<div class="card"> <div class="donut-chart chart2"> <div class="slice one"></div> <div class="slice two"></div> <div class="chart-center"> <span></span> </div> </div>
</div>
<div class="card"> <div class="donut-chart chart3"> <div class="slice one"></div> <div class="slice two"></div> <div class="chart-center"> <span></span> </div> </div>
</div>
<div class="card"> <div class="donut-chart chart4"> <div class="slice one"></div> <div class="slice two"></div> <div class="chart-center"> <span></span> </div> </div>
</div>
</body>
</html>

CSS Donut Charts - Script Codes CSS Codes

* { -webkit-box-sizing: border-box; box-sizing: border-box;
}
body { font-family: sans-serif; background: #e1e1e1;
}
.card { float: left; background: #fff; padding: 20px; margin: 0 20px 0 0;
}
.donut-chart { position: relative; border-radius: 50%; overflow: hidden;
}
.donut-chart .slice { position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.donut-chart .chart-center { position: absolute; border-radius: 50%;
}
.donut-chart .chart-center span { display: block; text-align: center;
}
.donut-chart.chart1 { width: 200px; height: 200px; background: #e1e1e1;
}
.donut-chart.chart1 .slice.one { clip: rect(0 200px 100px 0); -webkit-transform: rotate(90deg); transform: rotate(90deg); background: #50c690;
}
.donut-chart.chart1 .slice.two { clip: rect(0 100px 200px 0); -webkit-transform: rotate(270deg); transform: rotate(270deg); background: #50c690;
}
.donut-chart.chart1 .chart-center { top: 10px; left: 10px; width: 180px; height: 180px; background: #fff;
}
.donut-chart.chart1 .chart-center span { font-size: 40px; line-height: 180px; color: #50c690;
}
.donut-chart.chart1 .chart-center span:after { content: "75%";
}
.donut-chart.chart2 { width: 200px; height: 200px; background: #e1e1e1;
}
.donut-chart.chart2 .slice.one { clip: rect(0 200px 100px 0); -webkit-transform: rotate(90deg); transform: rotate(90deg); background: #48b2c1;
}
.donut-chart.chart2 .slice.two { clip: rect(0 100px 200px 0); -webkit-transform: rotate(327.6deg); transform: rotate(327.6deg); background: #48b2c1;
}
.donut-chart.chart2 .chart-center { top: 25px; left: 25px; width: 150px; height: 150px; background: #fff;
}
.donut-chart.chart2 .chart-center span { font-size: 40px; line-height: 150px; color: #48b2c1;
}
.donut-chart.chart2 .chart-center span:after { content: "91%";
}
.donut-chart.chart3 { width: 120px; height: 120px; background: #353535;
}
.donut-chart.chart3 .slice.one { clip: rect(0 120px 60px 0); -webkit-transform: rotate(144deg); transform: rotate(144deg); background: #e1e1e1;
}
.donut-chart.chart3 .slice.two { clip: rect(0 60px 120px 0); -webkit-transform: rotate(0deg); transform: rotate(0deg); background: #e1e1e1;
}
.donut-chart.chart3 .chart-center { top: 5px; left: 5px; width: 110px; height: 110px; background: #fff;
}
.donut-chart.chart3 .chart-center span { font-size: 40px; line-height: 110px; color: #353535;
}
.donut-chart.chart3 .chart-center span:after { content: "15%";
}
.donut-chart.chart4 { width: 240px; height: 240px; background: #f26a4a;
}
.donut-chart.chart4 .slice.one { clip: rect(0 240px 120px 0); -webkit-transform: rotate(252deg); transform: rotate(252deg); background: #e1e1e1;
}
.donut-chart.chart4 .slice.two { clip: rect(0 120px 240px 0); -webkit-transform: rotate(0deg); transform: rotate(0deg); background: #e1e1e1;
}
.donut-chart.chart4 .chart-center { top: 15px; left: 15px; width: 210px; height: 210px; background: #fff;
}
.donut-chart.chart4 .chart-center span { font-size: 60px; line-height: 210px; color: #f26a4a;
}
.donut-chart.chart4 .chart-center span:after { content: "45%";
}
CSS Donut Charts - Script Codes
CSS Donut Charts - Script Codes
Home Page Home
Developer Sean Stopnik
Username seanstopnik
Uploaded December 21, 2022
Rating 4
Size 2,908 Kb
Views 28,336
Do you need developer help for CSS Donut Charts?

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!

Sean Stopnik (seanstopnik) Script Codes
Create amazing web content with AI!

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!