You can do it with little bit of js and css.
I would personally avoid the progress element cause of cross-browser styling issues.
Third party libraries are good but they come with a significant cost.
The bloated css and js are sometimes not worth it.
Hope this helps.
<style>
.progress {
width: 100%;
position: relative;
background-color: orange;
}
.bar {
width: 0%;
height: 30px;
background-color: green;
text-align: center;
line-height: 30px;
color: black;
}
.bar-text {
position: absolute;
top: 0;
width: 100%;
height: 30px;
text-align: center;
line-height: 30px;
color: black;
}
</style>
<script>
function init() {
var bar = document.getElementById("bar");
var width = 0;
var id = setInterval(frame, 10);
function frame() {
if (width >= 100) {
clearInterval(id);
} else {
width++;
bar.style.width = width + '%';
document.querySelector('.bar-text').innerHTML = width * 1 + '%';
}
}
}
</script>
<div class="progress" id="progress">
<div class="bar" id="bar"></div>
<div class="bar-text">10%</div>
</div>
<br>
<button onclick="init()">Click Me</button>