Pie Chart is a type of graph that displays data in a circular shape and is generally used to show percentage or proportional data. The percentage represented in the graph by each category is provided near the corresponding slice of one portion of pie chart. These charts are very good for displaying data for two or more categories.
HTML Code: In the following code, the basic design or structure is shown.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <title>Pie Chart</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1>Pie Chart</h1> <div class="piechart"></div> </body> </html> |
CSS Code: In the following section, the design of pie-chart is demonstrated using some CSS properties.
<style> .piechart { margin-top: 300px; display: block; position: absolute; width: 400px; height: 400px; border-radius: 50%; background-image: conic-gradient( pink 70deg, lightblue 0 235deg, orange 0); } body, .piechart { display: flex; justify-content: center; align-items: center; } </style> |
Complete Code:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <title>Pie Chart</title> <style> .piechart { margin-top: 300px; display: block; position: absolute; width: 400px; height: 400px; border-radius: 50%; background-image: conic-gradient( pink 70deg, lightblue 0 235deg, orange 0); } body, .piechart { display: flex; justify-content: center; align-items: center; } </style> </head> <body> <h1>Pie Chart</h1> <div class="piechart"></div> </body> </html> |
Output:

Recommended Posts:
- HTML & CSS | Tabindex attribute & Navigation bars
- How to Create Image Overlay Hover using HTML & CSS ?
- How to create a Snackbar using HMTL, CSS & JavaScript?
- Neon Text Display Using HTML & CSS
- Text Animation with changing the color of the text using HTML & CSS
- Glowing Cube loader using HTML & CSS
- D3.js pie.padAngle() Function
- D3.js pie.startAngle() Function
- D3.js pie.endAngle() Function
- D3.js pie.value() Function
- D3.js pie.sortValues() Function
- D3.js pie() Function
- How to make dynamic chart in PHP using canvasJS?
- How to make an image center-aligned (vertically & horizontally) inside a bigger div using CSS?
- Self-Typing Text Effect using CSS & JavaScript
- How to create Glowing Star effect using HTML and CSS?
- Create a Sticky Social Media Bar using HTML and CSS
- Create a Mobile Toggle Navigation Menu using HTML, CSS and JavaScript
- Create a Search Bar using HTML and CSS
- How to create Right Aligned Menu Links using HTML and CSS ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


