Simple Pie Chart with HTML and CSS

ID - _BUGFISH - E#137
^Top
<< Back
Mobile-Menu










Simple Pie Chart with HTML and CSS
Category: HTML
Sub-Category:
Creator: Jan-Maurice Dahlmanns
Created: 2021-07-11 18:40:27
Modified: 2024-11-19 03:30:30
Views: 561

Caution: I do not guarantee the reliability of the information given here, the code described on this page is executed at your own risk and in the event of damage or other unforeseeable consequences I am in no way responsible or liable.

<style>
.pie {
     /* Basic layout */
     display: inline-block;
     width: 10em;
     height: 10em;
     border-radius: 50%;

     /* A little styling */
     border: .15em solid #fff;
     box-shadow: 0 .075em .2em .05em rgba(0,0,0,.25);

     /* fixes a minor clipping issue in Chrome */
     background-origin: border-box;
   }

.pie {
  background-image: conic-gradient(
    #d44 calc(3.6deg * var(--segment1)),
    #fc3 0 calc(3.6deg * var(--segment2)),
    #ac0 0
  );
}
</style>

<div class="pie" style="--segment1: 40; --segment2: 70;"></div>
<div class="pie" style="--segment1: 20; --segment2: 50;"></div>
<div class="pie" style="--segment1: 10; --segment2: 80;"></div>


Save this code into a .html file, open in your browser and see what is does, you have now 3 pie charts
only with HTML and CSS Code.

Currently 0 Upvotes!

captcha image
System - 2024-11-05 18:30:07
Commenting System Initialized! Have a very nice day!

Switches: 0 | Arrivals: 7 | Visits: 7
This Website is using Session Cookies for Site Functionality.