Hello this might be a simple for some. But I could not find how to solve it.
I have a progress bar that uses two images, and the colored image fills the background grayscale image with the percentual value.
The code below works, but it is filling the image from top to bottom, I want to fill from bottom to top. I’ve tried using flexbox, switch from top 0, to bottom 0, but didn’t work. Could someone give some help?
Thanks in advance.
function setProgress(percent) {
var progressBar = document.getElementById('progress');
progressBar.style.height = percent + '%';
}
setProgress(90);
.progress-container {
width: 268px;
height: 608px;
background-image: url('https://i.imgur.com/jl6OFd6.png');
background-size: cover;
border-radius: 10px;
overflow: hidden;
display: inline-block;
margin-right: 20px;
bottom:0;
position: relative;
top:0;
}
.progress {
width: 100%;
height: 0%;
background-image: url('https://i.imgur.com/Xv6WaQ5.png');
background-size: cover;
background-position: top;
position: relative;
bottom: 0;
left: 0;
transition: height 0.2s ease-out;
}
<div class="progress-container">
<div class="progress" id="progress"></div>
</div>
2
Answers
Just change ‘background-position / position’.
Try this !!!
In html:
In your CSS