1 实现效果

2 实现代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
#progress {
width: 300px;
height: 20px;
border-radius: 0;
-webkit-appearance: none;
appearance: none;
}
#progress::-webkit-progress-bar {
background-color: #f3f3f3;
border-radius: 0;
}
#progress::-webkit-progress-value {
background-color: #007bff;
border-radius: 0;
}
#progress::-moz-progress-bar {
background-color: #007bff;
}
</style>
</head>
<body>
<progress id="progress" max="100" value="0"></progress> <span id="progressText">0%</span>
<script>
var progressElement = document.getElementById("progress");
var progressTextElement = document.getElementById("progressText");
var currentValue = 0;
var intervalId;
function updateProgress() {
currentValue++;
if (currentValue <= 100) {
progressElement.value = currentValue;
progressTextElement.textContent = currentValue + '%';
} else {
currentValue = 0;
progressElement.value = currentValue;
progressTextElement.textContent = currentValue + '%';
}
}
intervalId = setInterval(updateProgress, 100);
</script>
</div>
</body>
</html>