JSFiddle - React, Tailwind, and code Playground
by kplcode
HTML
<div class="inner-content text-center">
<div class="c100 p50 dark big center green">
<span>50%</span>
<div class="slice"><div class="bar"></div><div class="fill"></div></div>
</div>
<p>.big.dark.green</p>
</div>
CSS
.c100.dark {
background-color: #777777;
}
.c100.big {
font-size: 240px;
}
.c100.center {
float: none;
margin: 0 auto;
}
.c100 {
position: relative;
font-size: 120px;
width: 1em;
height: 1em;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
float: left;
margin: 0 0.1em 0.1em 0;
background-color: #fff;
}
.c100.dark > span {
color: #777777;
}
.c100 > span {
position: absolute;
width: 100%;
z-index: 1;
left: 0;
top: 0;
width: 5em;
line-height: 5em;
font-size: 0.2em;
color: #cccccc;
display: block;
text-align: center;
white-space: nowrap;
-webkit-transition-property: all;
-moz-transition-property: all;
-o-transition-property: all;
transition-property: all;
-webkit-transition-duration: 0.2s;
-moz-transition-duration: 0.2s;
-o-transition-duration: 0.2s;
transition-duration: 0.2s;
-webkit-transition-timing-function: ease-out;
-moz-transition-timing-function: ease-out;
-o-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.c100 .slice {
position: absolute;
width: 1em;
height: 1em;
clip: rect(0em, 1em, 1em, 0.5em);
}
.c100 *, .c100 *:before, .c100 *:after {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
*, *:before, *:after {
/* -webkit-box-sizing: border-box; */
-moz-box-sizing: border-box;
/* box-sizing: border-box; */
}
.c100.p50 .bar {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
.pie, .c100 .bar, .c100.p51 .fill, .c100.p52 .fill, .c100.p53 .fill, .c100.p54 .fill, .c100.p55 .fill, .c100.p56 .fill, .c100.p57 .fill, .c100.p58 .fill, .c100.p59 .fill, .c100.p60 .fill, .c100.p61 .fill, .c100.p62 .fill,...