Creé una barra de progreso agrupada para cargar varias barras de progreso con diferentes colores. También estoy añadiendo border-right
de 1px
entre cada barra de progreso. Estoy tratando de averiguar si uno de la barra de progreso tiene valor 0
, entonces no añadir border-right
de 1px
porque en este momento si el valor es 0
que se suma total de 2px
de la frontera a la derecha. ¿Cómo puedo arreglarlo?
Consulte el código de muestra a continuación. Tengo un valor de la tercera barra de progreso, 0
por lo que agrega un borde de 2px
.
https://codepen.io/Nick1212/pen/KvggVY
.well-ProgressGroup {
display: flex;
background: #d3d4d5;
flex-direction: row;
border-radius: 0.5em;
overflow: auto;
position: relative;
z-index: 1;
}
@keyframes loadbar {
0% {
opacity: 1;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
.well-ProgressGroup--progress {
transform: translateX(-100%) translate3d(0, 0, 0);
opacity: 0;
background: blue;
}
.well-ProgressGroup--progress:not(:last-child) {
border-right: 1px solid white;
}
.well-background--concept1 {
background: tomato;
}
.well-background--concept2 {
background: blue;
}
.well-background--concept3 {
background: purple;
}
.well-background--concept4 {
background: red;
}
.well-background--concept5 {
background: green;
}
<div>
<h1 class="u-pb--lg text-bold">Grouped ProgressBar Component Examples</h1>
<div class="space">
<div> Example: User earning all the points</div>
<div class="well-ProgressGroup">
<!-- react-text: 94 -->
<!-- /react-text -->
<div class="well-background--concept1 well-ProgressGroup--progress" style="width: 50%; animation: 0.5s linear 0s forwards loadbar;z-index: -1; height: 50px;"></div>
<div class="well-background--concept2 well-ProgressGroup--progress" style="width: 75%; animation: 0.5s linear 0.5s forwards loadbar; z-index: -2; height: 50px;"></div>
<div class="well-background--concept3 well-ProgressGroup--progress" style="width: 0%; animation: 0.5s linear 1s forwards loadbar; z-index: -3; height: 50px;"></div>
<div class="well-background--concept4 well-ProgressGroup--progress" style="width: 250%; animation: 0.5s linear 1.5s forwards loadbar; z-index: -4; height: 50px;"></div>
<div class="well-background--concept5 well-ProgressGroup--progress" style="width: 300%; animation: 0.5s linear 2s forwards loadbar; z-index: -5; height: 50px;"></div>
<div class="well-background--concept5 well-ProgressGroup--progress" style="width: 300%; animation: 0.5s linear 2.5s forwards loadbar; z-index: -5; height: 50px;"></div>
<!-- react-text: 101 -->
<!-- /react-text -->
</div>
</div>
</div>
Puede utilizar el :not([style*="width: 0"])
selector para seleccionar elementos que no contienen width: 0
en su style
atributo. Manifestación:
.well-ProgressGroup {
display: flex;
background: #d3d4d5;
flex-direction: row;
border-radius: 0.5em;
overflow: auto;
position: relative;
z-index: 1;
}
@keyframes loadbar {
0% {
opacity: 1;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
.well-ProgressGroup--progress {
transform: translateX(-100%) translate3d(0, 0, 0);
opacity: 0;
background: blue;
}
.well-ProgressGroup--progress:not(:last-child):not([style*="width: 0"]) {
border-right: 1px solid white;
}
.well-background--concept1 {
background: tomato;
}
.well-background--concept2 {
background: blue;
}
.well-background--concept3 {
background: purple;
}
.well-background--concept4 {
background: red;
}
.well-background--concept5 {
background: green;
}
<div>
<h1 class="u-pb--lg text-bold">Grouped ProgressBar Component Examples</h1>
<div class="space">
<div> Example: User earning all the points</div>
<div class="well-ProgressGroup">
<!-- react-text: 94 -->
<!-- /react-text -->
<div class="well-background--concept1 well-ProgressGroup--progress" style="width: 50%; animation: 0.5s linear 0s forwards loadbar;z-index: -1; height: 50px;"></div>
<div class="well-background--concept2 well-ProgressGroup--progress" style="width: 75%; animation: 0.5s linear 0.5s forwards loadbar; z-index: -2; height: 50px;"></div>
<div class="well-background--concept3 well-ProgressGroup--progress" style="width: 0%; animation: 0.5s linear 1s forwards loadbar; z-index: -3; height: 50px;"></div>
<div class="well-background--concept4 well-ProgressGroup--progress" style="width: 250%; animation: 0.5s linear 1.5s forwards loadbar; z-index: -4; height: 50px;"></div>
<div class="well-background--concept5 well-ProgressGroup--progress" style="width: 300%; animation: 0.5s linear 2s forwards loadbar; z-index: -5; height: 50px;"></div>
<div class="well-background--concept5 well-ProgressGroup--progress" style="width: 300%; animation: 0.5s linear 2.5s forwards loadbar; z-index: -5; height: 50px;"></div>
<!-- react-text: 101 -->
<!-- /react-text -->
</div>
</div>
</div>
Este artículo se recopila de Internet, indique la fuente cuando se vuelva a imprimir.
En caso de infracción, por favor [email protected] Eliminar
Déjame decir algunas palabras