TheBestTutorials.css Progress Bars
Progress Bars
A progress bar can be used to show how far along a user is in a process:
Basic Progress Bar
The TheBestTutorials-progress-container class defines a container for the progress bar, and the subhodaya-progressbar defines the actual progress bar (the "filled" area). Set the width of the progress bar with the CSS width property:
Example
<div class="subhodaya-progressbar" style="width:10%"></div>
</div>
Progress Bar Sizes
Set the width/size of the progress bar with a percentage value from 0 to 100%:
Example
<div class="subhodaya-progressbar" style="width:50%"></div>
</div>
Progress Bar Colors
By default, the color of the subhodaya-progress-container is light grey and the subhodaya-progressbar is grey:
Change their color with any of the subhodaya.css color classes:
Example
<div class="subhodaya-progressbar subhodaya-blue" style="width:75%"></div>
</div>
Rounded Progress Bars
Use any of the TheBestTutorials-round classes to add rounded corners to your progress bars:
Example
<div class="subhodaya-progressbar subhodaya-round" style="width:25%"></div>
</div>
Progress Bar Labels
Add a new element inside the "subhodaya-progressbar" to add a label to the progress bar.
Tip: Use the subhodaya-center class to always keep the label centered. If omitted, it will be left aligned.
Example
<div id="myBar" class="subhodaya-progressbar subhodaya-green" style="width:25%">
<div class="subhodaya-center subhodaya-text-white">25%</div>
</div>
</div>
Dynamic Progress Bar
Use JavaScript to create a dynamic progress bar:
Example
<div id="myBar" class="subhodaya-progressbar subhodaya-green" style="width:1%"></div>
</div>
<button class="subhodaya-btn" onclick="move()">Click Me</button>
<script>
function move() {
var elem = document.getElementById("myBar");
var width = 1;
var id = setInterval(frame, 10);
function frame() {
if (width >= 100) {
clearInterval(id);
} else {
width++;
elem.style.width = width + '%';
}
}
}
</script>
Dynamic Progress Bar with Labels
Centered label:
Left-aligned label:
Label outside of the progress bar:
Another example (advanced):