Note that there are some explanatory texts on larger screens.

plurals
  1. POcss radial progress bar increment of 1 percent
    primarykey
    data
    text
    <p>I found a sleek Pure CSS knob on codepen, but it only produces classes for percentages for multiples of 5 (eg. 5%, 10%, 20%, etc.).</p> <p><a href="http://codepen.io/brewing/pen/Imxpc" rel="nofollow">http://codepen.io/brewing/pen/Imxpc</a> </p> <pre><code>$barColor: tomato $overlayColor: #fffde8 $backColor: #2f3439 $step: 5 // step of % for created classes $loops: round(100 / $step) $increment: round(360 / $loops) $half: round($loops / 2) @for $i from 0 through $loops .progress-#{$i*$step} @if $i &lt; $half $nextdeg: 90deg + ( $increment * $i ) background-image: linear-gradient(90deg, $backColor 50%, transparent 50%, transparent), linear-gradient($nextdeg, $barColor 50%, $backColor 50%, $backColor) @else $nextdeg: -90deg + ( $increment * ( $i - $half ) ) background-image: linear-gradient($nextdeg, $barColor 50%, transparent 50%, transparent), linear-gradient(270deg, $barColor 50%, $backColor 50%, $backColor) </code></pre> <p>The last 3 classes generated look like this:</p> <pre><code>.progress-90 { background-image: linear-gradient(54deg, tomato 50%, transparent 50%, transparent), linear-gradient(270deg, tomato 50%, #2f3439 50%, #2f3439); } .progress-95 { background-image: linear-gradient(72deg, tomato 50%, transparent 50%, transparent), linear-gradient(270deg, tomato 50%, #2f3439 50%, #2f3439); } .progress-100 { background-image: linear-gradient(90deg, tomato 50%, transparent 50%, transparent), linear-gradient(270deg, tomato 50%, #2f3439 50%, #2f3439); } </code></pre> <p>But when I try to change it to produce classes for all of the percentages from 0 through 100, the classes end up having the wrong angle for the first gradient:</p> <pre><code>.progress-90 { background-image: linear-gradient(70deg, tomato 50%, transparent 50%, transparent), linear-gradient(270deg, tomato 50%, #2f3439 50%, #2f3439); } .progress-95 { background-image: linear-gradient(90deg, tomato 50%, transparent 50%, transparent), linear-gradient(270deg, tomato 50%, #2f3439 50%, #2f3439); } .progress-100 { background-image: linear-gradient(110deg, tomato 50%, transparent 50%, transparent), linear-gradient(270deg, tomato 50%, #2f3439 50%, #2f3439); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload