CSS and some background gradients
Instead of trying to paint the green part, you can draw the white parts:
pie { border-radius: 50%; background-color: green; } .ten { background-image: linear-gradient(126deg, transparent 50%, white 50%), linear-gradient(90deg, white 50%, transparent 50%); }
pie { width: 5em; height: 5em; display: block; border-radius: 50%; background-color: green; border: 2px solid green; float: left; margin: 1em; } .ten { background-image: linear-gradient(126deg, transparent 50%, white 50%), linear-gradient(90deg, white 50%, transparent 50%); } .twentyfive { background-image: linear-gradient(180deg, transparent 50%, white 50%), linear-gradient(90deg, white 50%, transparent 50%); } .fifty { background-image: linear-gradient(90deg, white 50%, transparent 50%); } .seventyfive { background-image: linear-gradient(180deg, transparent 50%, green 50%), linear-gradient(90deg, white 50%, transparent 50%); } .onehundred { background-image: none; }
<pie class="ten"></pie> <pie class="twentyfive"></pie> <pie class="fifty"></pie> <pie class="seventyfive"></pie> <pie class="onehundred"></pie>
Demo: http://jsfiddle.net/jonathansampson/7PtEm/

Scalable Vector Graphics
If this is an option, you can achieve a similar effect using the SVG <circle> and <path> elements. Consider the following:
<svg> <circle cx="115" cy="115" r="110"></circle> <path d="M115,115 L115,5 A110,110 1 0,1 190,35 z"></path> </svg>
The above is fairly straightforward. We have an element containing a circle and a path. The center of the circle is 115x115 (SVG element 230x230). The circle has a radius of 110, which makes it common 220 (leaving a border of 10).
Then we add the <path> element, which is the hardest part of this example. This element has one attribute that determines where and how the path is drawn. It starts with the following value:
M115,115
An indication of the path begins in the center of the above circle. Then we will draw a line from this place to the following place:
L115,5
This draws a vertical line from the center of the circle to the top of the element (well, five pixels from the top). It is at this moment that everything becomes a little more complicated, but still very clear.
Now we will draw an arc from our current location (115.5):
A110,110 1 0,1 190,35 z
This creates our arc and gives it a radius corresponding to our circle (110). The two values represent the x-radius and y-radius, and both are equal, since we are dealing with a circle. The next set of important numbers is the last, 190,35 . This tells the arc where to fill.
As for the rest of the information ( 1 0,1 and z ), they control the curvature, direction and output of the arc itself. You can learn more about them by contacting any SVG online link.
To perform a “slice” of a different size, simply change 190,35 to reflect a larger or smaller set of coordinates. You may find that you need to create a second arc if you want to span more than 180 degrees.
If you want to determine the x and y coordinates at an angle, you can use the following equations:
x = cx + r * cos(a) y = cy + r * sin(a)
In the above example, the degree of 76 would be:
x = 115 + 110 * cos(76) y = 115 + 110 * sin(76)
Which gives us 205.676,177.272 .
With some ease, you can create the following:
circle { fill: #f1f1f1; stroke: green; stroke-width: 5; } path { fill: green; } svg.pie { width: 230px; height: 230px; }
<svg class="pie"> <circle cx="115" cy="115" r="110"></circle> <path d="M115,115 L115,5 A110,110 1 0,1 190,35 z"></path> </svg> <svg class="pie"> <circle cx="115" cy="115" r="110"></circle> <path d="M115,115 L115,5 A110,110 1 0,1 225,115 z"></path> </svg> <svg class="pie"> <circle cx="115" cy="115" r="110"></circle> <path d="M115,115 L115,5 A110,110 1 0,1 115,225 A110,110 1 0,1 35,190 z"></path> </svg>
Demo: http://jsfiddle.net/jonathansampson/tYaVW/
