<div>
<div class="container">
<div class="progress"></div>
</div>
<div class="container">
<div class="progressInfinite"></div>
</div>
</div>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container {
margin-top: 2rem;
width: 250px;
background: rgb(204, 204, 204);
height: 40px;
overflow: hidden;
}
.progress {
width: 100%;
height: 40px;
background: rgb(4, 214, 4);
transform: translateY(-100%);
animation: progressMe 5s linear forwards;
}
@keyframes progressMe {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(0%);
}
}
.progressInfinite {
width: 100%;
height: 40px;
background: rgb(4, 214, 4);
transform: translateY(-100%);
animation: progressInfiniteMe 10s linear infinite;
}
@keyframes progressInfiniteMe {
0%, 100% {
transform: translateX(-100%);
}
50% {
transform: translateX(0%);
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.