tricks the snippet ejemplos and jquery html css html5 css3

jquery - the - Añadiendo separador al borde de la barra.



snippet html css (5)

Esto es lo mejor que puedo hacer. He agregado antes y después de pseudo elementos a .slice y les .slice agregado diferentes valores de clip y una rotación de 90 grados al pseudoelemento anterior. Los pseudo elementos están vinculados al .slice CSS, por lo que al ajustar la rotación también se ajustará el pseudo-elemento posterior.

.pie, .c100 .bar, .c100 .slice:before, .c100 .slice:after { position: absolute; border: 0.08em solid #307bbb; width: 0.84em; height: 0.84em; clip: rect(0em, 0.5em, 1em, 0em); border-radius: 50%; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); } .c100 .slice:before, .c100 .slice:after { content:" "; display:block; border: 0.08em solid #fff; z-index:2; } .c100 .slice:before { clip:rect(0.47em, 0.1em, 1em, 0em); -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(90deg); } .c100 .slice:after { clip:rect(0em, 0.5em, 1em, 0.47em); } .c100 { position: relative; font-size: 120px; width: 1em; height: 1em; border-radius: 50%; float: left; margin: 0 0.1em 0.1em 0; background-color: #cccccc; } .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:after { position: absolute; top: 0.08em; left: 0.08em; display: block; content: " "; border-radius: 50%; background-color: #f5f5f5; width: 0.84em; height: 0.84em; -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-in; -moz-transition-timing-function: ease-in; -o-transition-timing-function: ease-in; transition-timing-function: ease-in; } .c100 .slice { position: absolute; width: 1em; height: 1em; clip: rect(0em, 1em, 1em, 0.5em); } .c100.p25 .bar, .c100 .slice:after { -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(90deg); }

<div class="c100 p25"> <span>25%</span> <div class="slice"> <div class="bar"></div> <div class="fill"></div> </div> </div>

Lo que actualmente tenemos es algo como

y el objetivo es la tabla con el separador en ambas edades, como en la siguiente imagen

han utilizado el plugin Pure CSS Circular Percentage Bar para lograrlo.

Y para agregar separador en las dos edades de bar hemos intentado dar:

orden, sombra, altura, ancho

a la siguiente clase.

.pie, .c100 .bar: después de .pie, .c100 .bar: antes

.c100 .slice: antes .c100 .slice: después

Y así sucesivamente con otros elementos pero no consiguió el éxito.

Y el violín para el mismo es https://jsfiddle.net/bhavikvaishnani/r7emrhv8/6/

.pie, .c100 .bar { position: absolute; border: 0.08em solid #307bbb; width: 0.84em; height: 0.84em; clip: rect(0em, 0.5em, 1em, 0em); border-radius: 50%; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); } .c100 { position: relative; font-size: 120px; width: 1em; height: 1em; border-radius: 50%; float: left; margin: 0 0.1em 0.1em 0; background-color: #cccccc; } .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:after { position: absolute; top: 0.08em; left: 0.08em; display: block; content: " "; border-radius: 50%; background-color: #f5f5f5; width: 0.84em; height: 0.84em; -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-in; -moz-transition-timing-function: ease-in; -o-transition-timing-function: ease-in; transition-timing-function: ease-in; } .c100 .slice { position: absolute; width: 1em; height: 1em; clip: rect(0em, 1em, 1em, 0.5em); } .c100.p25 .bar { -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(90deg); }

<div class="c100 p25"> <span>25%</span> <div class="slice"> <div class="bar"></div> <div class="fill"></div> </div> </div>

Necesitamos la solución de manera que podamos cambiar dinámicamente el valor del porcentaje.


Intenté este, creo que puedes aplicar el mismo css para rellenar la clase y luego cambiar su clip para aumentar el tamaño del arco. Si está cambiando dinámicamente el valor del clip para la clase de barra, entonces también puede hacer lo mismo para el relleno.

.pie, .c100 .bar { position: absolute; border: 0.08em solid #307bbb; width: 0.84em; height: 0.84em; clip: rect(0em, 0.5em, 0.5em, 0em); border-radius: 50%; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); } .c100 { position: relative; font-size: 120px; width: 1em; height: 1em; border-radius: 50%; float: left; margin: 0 0.1em 0.1em 0; background-color: #cccccc; } .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:after { position: absolute; top: 0.08em; left: 0.08em; display: block; content: " "; border-radius: 50%; background-color: #f5f5f5; width: 0.84em; height: 0.84em; -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-in; -moz-transition-timing-function: ease-in; -o-transition-timing-function: ease-in; transition-timing-function: ease-in; } .c100 .slice { position: absolute; width: 1em; height: 1em; } .c100.p25 .bar { -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(90deg); z-index:101; } .c100.p25 .fill { position: absolute; border: 0.08em solid #fff; width: 0.84em; height: 0.84em; clip: rect(0em, 0.55em, 0.55em, 0em); border-radius: 50%; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(90deg); z-index: 100; }

<div class="c100 p25"> <span>25%</span> <div class="slice"> <div class="bar"></div> <div class="fill"></div> </div> </div>


La respuesta que sugiere utilizar .bar:before y .bar:after es incorrecta, porque este objeto no tiene información sobre el principio y el final de la franja de progreso.

Tenga en cuenta que la propiedad "clip" se ha usado dos veces: el primer uso se aplica a .slice y el segundo al objeto .bar . Estos "clips" definen dónde están el principio y el final de la banda.

Entonces, la solución es usar pseudoselectores en ambos:

.c100 .slice:before { content: ''''; position: absolute; width: 5px; height: .08em; background-color: #fff; left: calc(50% - 3px); z-index: 2; } .c100 .bar:before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 5px; transform: rotate(90deg); background-color: #fff; }

Por favor, compruebe el ejemplo de trabajo: fiddle


Puede agregar .bar: antes y .bar: después

.c100 .bar:before { border: 2px solid #fff; left: -10px; top: 47px; width: 10px; } .c100 .bar:after { content: "|"; top: -21px; position: absolute; border: 3px solid #fff; left: 47px; padding:0; margin:0; display:block; }

Finalmente será jsfiddle

.pie, .c100 .bar { position: absolute; border: 0.08em solid #307bbb; width: 0.84em; height: 0.84em; clip: rect(0em, 0.5em, 1em, 0em); border-radius: 50%; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); } .c100 { position: relative; font-size: 120px; width: 1em; height: 1em; border-radius: 50%; float: left; margin: 0 0.1em 0.1em 0; background-color: #cccccc; } .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:after { position: absolute; top: 0.08em; left: 0.08em; display: block; content: " "; border-radius: 50%; background-color: #f5f5f5; width: 0.84em; height: 0.84em; -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-in; -moz-transition-timing-function: ease-in; -o-transition-timing-function: ease-in; transition-timing-function: ease-in; } .c100 .slice { position: absolute; width: 1em; height: 1em; clip: rect(0em, 1em, 1em, 0.5em); } .c100 .slice:before {} .c100.p25 .bar { -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(90deg); } .c100 .slice:before, .c100 .slice:after {} .pie, .c100 .bar:after, .pie, .c100 .bar:before { content: ""; position: absolute; left: 0; top: 0; box-shadow: } .c100 .bar:before { border: 2px solid #fff; left: -10px; top: 47px; width: 10px; } .c100 .bar:after { content: "|"; top: -21px; position: absolute; border: 3px solid #fff; left: 47px; padding: 0; margin: 0; display: block; }

<body> <div class="c100 p25"> <span>25%</span> <div class="slice"> <div class="bar"></div> <div class="fill"></div> </div> </div> </body>

Solo puedes hacer cambios en la propiedad de ancho izquierdo y de borde para cambiar el ancho.


Vea el fragmento aquí, si esto puede ayudar

.pie, .c100 .bar { position: absolute; border: 0.08em solid #307bbb; width: 0.84em; height: 0.84em; clip: rect(0em, 0.5em, 1em, 0em); border-radius: 50%; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); } .c100 { position: relative; font-size: 120px; width: 1em; height: 1em; border-radius: 50%; float: left; margin: 0 0.1em 0.1em 0; background-color: #cccccc; } .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:after { position: absolute; top: 0.08em; left: 0.08em; display: block; content: " "; border-radius: 50%; background-color: #f5f5f5; width: 0.84em; height: 0.84em; -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-in; -moz-transition-timing-function: ease-in; -o-transition-timing-function: ease-in; transition-timing-function: ease-in; } .c100 .slice { position: absolute; width: 1em; height: 1em; clip: rect(0em, 1em, 1em, 0.5em); } .c100 .slice:before {} .c100.p25 .bar { -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); -ms-transform: rotate(180deg); -o-transform: rotate(180deg); transform: rotate(180deg); } .c100 .slice:before, .c100 .slice:after {} .pie, .c100 .bar:after, .pie, .c100 .bar:before { content: ""; position: absolute; left: 0; top: 0; box-shadow: } div.bar:before { content: ""; position: absolute; border: 0.08em solid #ffffff; width: 0.84em; height: 0.84em; clip: rect(0em, 0.5em, 1em, 0em); border-radius: 50%; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); transform: rotate(180deg); box-sizing: content-box; left: -0.1em !important; top: -0.08em !important; }

<body> <div class="c100 p25"> <span>25%</span> <div class="slice"> <div class="bar"></div> <div class="fill"></div> </div> </div> </body>