animation .
. ul, .
, . , 0 100% 1 4, 1 2, 2 3 ..
:
ul .
.progressbar::after {
content: '';
width: 68%;
height: 3px;
background: #B9B9B9;
position: absolute;
left: 17%;
top: 17px;
z-index: -2;
}
::after 0 . ( :, ).
, , , , .
, . ? scale 1 .
.progressbar li.half-complete:after {
transform: scaleX(0);
color: white;
animation: fill 100ms linear forwards;
background-color: #27ae60;
}
:
@keyframes fill {
to {
transform: scaleX(1);
}
}
:
.progressbar {
margin-bottom: 30px;
margin-top: 10px;
counter-reset: step;
clear: both;
list-style: none;
position: relative;
}
.progressbar li {
font-size: 12px;
width: 24%;
float: left;
position: relative;
text-align: center;
}
.progressbar li:before {
content: counter(step);
counter-increment: step;
width: 25px;
line-height: 25px;
display: block;
font-size: 12px;
color: transparent;
border: 6px solid #ececec;
background: #27ae60;
border-radius: 19px;
margin: 0 auto 4px;
}
.progressbar li:after {
content: '';
width: 85%;
height: 3px;
position: absolute;
left: -42%;
top: 17px;
z-index: -1;
}
.progressbar::after {
content: '';
width: 68%;
height: 3px;
background: #B9B9B9;
position: absolute;
left: 17%;
top: 17px;
z-index: -2;
}
.progressbar li:first-child:after {
content: none;
}
.progress-payment li {
width: 50%;
}
.progressbar li.active:after,
.progressbar li.active:before {
background: #27ae60;
color: white;
}
.progressbar li.half-complete:before {
color: white;
}
.progressbar li.complete:after {
background: #27ae60;
}
.progressbar li.half-complete:after {
transform: scaleX(0);
color: white;
animation: fill 3s linear forwards;
background-color: #27ae60;
}
@keyframes fill {
to {
transform: scaleX(1);
}
}
<ul class="progressbar">
<li class="complete">Order Placed</li>
<li class="complete">Shipped</li>
<li class="active">Completed</li>
<li class="half-complete">Settled</li>
</ul>
Hide result, , , , 50%.
, , , animation-delay, , , .
transform-origin: left , animation-delay:
.progressbar {
margin-bottom: 30px;
margin-top: 10px;
counter-reset: step;
clear: both;
list-style: none;
position: relative;
}
.progressbar li {
font-size: 12px;
width: 24%;
float: left;
position: relative;
text-align: center;
}
.progressbar li:before {
content: counter(step);
counter-increment: step;
width: 25px;
line-height: 25px;
display: block;
font-size: 12px;
color: transparent;
border: 6px solid #ececec;
background: #27ae60;
border-radius: 19px;
margin: 0 auto 4px;
}
.progressbar li:after {
content: '';
width: 85%;
height: 3px;
position: absolute;
left: -42%;
top: 17px;
z-index: -1;
}
.progressbar::after {
content: '';
width: 68%;
height: 3px;
background: #B9B9B9;
position: absolute;
left: 17%;
top: 17px;
z-index: -2;
}
.progressbar li:first-child:after {
content: none;
}
.progress-payment li {
width: 50%;
}
.progressbar li.active:after,
.progressbar li.active:before {
background: #27ae60;
color: white;
}
.progressbar li.half-complete:before {
color: white;
}
.progressbar li.complete:after {
background: #27ae60;
}
.progressbar li.half-complete:after {
transform: scaleX(0);
color: white;
animation: fill 3s linear forwards;
transform-origin: left;
background-color: #27ae60;
}
@keyframes fill {
to {
transform: scaleX(1);
}
}
<ul class="progressbar">
<li class="complete">Order Placed</li>
<li class="complete">Shipped</li>
<li class="active">Completed</li>
<li class="half-complete">Settled</li>
</ul>
Hide resultanimation-delay :
.progressbar {
margin-bottom: 30px;
margin-top: 10px;
counter-reset: step;
clear: both;
list-style: none;
position: relative;
}
.progressbar li {
font-size: 12px;
width: 24%;
float: left;
position: relative;
text-align: center;
}
.progressbar li:before {
content: counter(step);
counter-increment: step;
width: 25px;
line-height: 25px;
display: block;
font-size: 12px;
color: transparent;
border: 6px solid #ececec;
background: #27ae60;
border-radius: 19px;
margin: 0 auto 4px;
}
.progressbar li:after {
content: '';
width: 85%;
height: 3px;
position: absolute;
left: -42%;
top: 17px;
z-index: -1;
}
.progressbar::after {
content: '';
width: 68%;
height: 3px;
background: #B9B9B9;
position: absolute;
left: 17%;
top: 17px;
z-index: -2;
}
.progressbar li:first-child:after {
content: none;
}
.progress-payment li {
width: 50%;
}
.progressbar li.active:after,
.progressbar li.active:before {
background: #27ae60;
color: white;
}
.progressbar li.half-complete:before {
color: white;
}
.progressbar li.complete:after {
background: #27ae60;
}
.progressbar li.half-complete:after {
transform: scaleX(0);
color: white;
animation: fill 3s linear forwards;
transform-origin: left;
animation-delay: -1.5s;
background-color: #27ae60;
}
@keyframes fill {
to {
transform: scaleX(1);
}
}
<ul class="progressbar">
<li class="complete">Order Placed</li>
<li class="complete">Shipped</li>
<li class="active">Completed</li>
<li class="half-complete">Settled</li>
</ul>
Hide result- 3s, , 50%, ., .
animation-play-state: paused; .
.progressbar {
margin-bottom: 30px;
margin-top: 10px;
counter-reset: step;
clear: both;
list-style: none;
position: relative;
}
.progressbar li {
font-size: 12px;
width: 24%;
float: left;
position: relative;
text-align: center;
}
.progressbar li:before {
content: counter(step);
counter-increment: step;
width: 25px;
line-height: 25px;
display: block;
font-size: 12px;
color: transparent;
border: 6px solid #ececec;
background: #27ae60;
border-radius: 19px;
margin: 0 auto 4px;
}
.progressbar li:after {
content: '';
width: 85%;
height: 3px;
position: absolute;
left: -42%;
top: 17px;
z-index: -1;
}
.progressbar::after {
content: '';
width: 68%;
height: 3px;
background: #B9B9B9;
position: absolute;
left: 17%;
top: 17px;
z-index: -2;
}
.progressbar li:first-child:after {
content: none;
}
.progress-payment li {
width: 50%;
}
.progressbar li.active:after,
.progressbar li.active:before {
background: #27ae60;
color: white;
}
.progressbar li.half-complete:before {
color: white;
}
.progressbar li.complete:after {
background: #27ae60;
}
.progressbar li.half-complete:after {
transform: scaleX(0);
color: white;
animation: fill 3s linear forwards;
transform-origin: left;
animation-delay: -1.5s;
animation-play-state: paused;
background-color: #27ae60;
}
@keyframes fill {
to {
transform: scaleX(1);
}
}
<ul class="progressbar">
<li class="complete">Order Placed</li>
<li class="complete">Shipped</li>
<li class="active">Completed</li>
<li class="half-complete">Settled</li>
</ul>
Hide result, javascript, , :
.progressbar li.half-complete:after {
transform: scaleX(0);
color: white;
animation: fill 100ms linear forwards;
transform-origin: left;
animation-delay: inherit;
animation-play-state: paused;
background-color: #27ae60;
}
:
var progress = document.getElementById("progress");
var progressBarLastItem = document.querySelector(".progressbar li:last-child");
progress.addEventListener("change", function() {
progressBarLastItem.style.animationDelay = "-" + this.value + "ms";
});
.progressbar {
margin-bottom: 30px;
margin-top: 10px;
counter-reset: step;
clear: both;
list-style: none;
position: relative;
}
.progressbar li {
font-size: 12px;
width: 24%;
float: left;
position: relative;
text-align: center;
}
.progressbar li:before {
content: counter(step);
counter-increment: step;
width: 25px;
line-height: 25px;
display: block;
font-size: 12px;
color: transparent;
border: 6px solid #ececec;
background: #27ae60;
border-radius: 19px;
margin: 0 auto 4px;
}
.progressbar li:after {
content: '';
width: 85%;
height: 3px;
position: absolute;
left: -42%;
top: 17px;
z-index: -1;
}
.progressbar::after {
content: '';
width: 68%;
height: 3px;
background: #B9B9B9;
position: absolute;
left: 17%;
top: 17px;
z-index: -2;
}
.progressbar li:first-child:after {
content: none;
}
.progress-payment li {
width: 50%;
}
.progressbar li.active:after,
.progressbar li.active:before {
background: #27ae60;
color: white;
}
.progressbar li.half-complete:before {
color: white;
}
.progressbar li.complete:after {
background: #27ae60;
}
.progressbar li.half-complete:after {
transform: scaleX(0);
color: white;
animation: fill 100ms linear forwards;
transform-origin: left;
animation-delay: inherit;
animation-play-state: paused;
background-color: #27ae60;
}
@keyframes fill {
to {
transform: scaleX(1);
}
}
<ul class="progressbar">
<li class="complete">Order Placed</li>
<li class="complete">Shipped</li>
<li class="active">Completed</li>
<li class="half-complete">Settled</li>
</ul>
<input id="progress" type="range" min="0" max="100">
Hide result