5 Oct 2023

How to Create Progress bar in html

Are you looking to add a touch of professionalism and interactivity to your website with a stunning progress bar? Look no further! In this article, we will guide you through seven simple steps to create an eye-catching progress bar using HTML. Whether you are a beginner or an experienced coder, these steps are designed to be easy to follow and implement. A progress bar not only adds visual appeal to your website but also keeps your users informed about the progress of a task or a process. With these simple steps, you can create a progress bar that is not only beautiful but also functional, improving the user experience on your site. From defining the HTML structure to customizing the colors and adding animations, we will cover everything you need to know to create a stunning progress bar. So, get ready to impress your visitors with a captivating progress bar that adds a professional touch to your website!

  1. Why Progress Bar Matters?
  2. What does a progress bar do?
  3. Types of Progress Bars with examples
    1. Animated Progress Bar
    2. Straight Progress Bar
    3. Animated Circular Progress Bars
    4. Vertical Progress Bars
    5. Thermometer Progress Bar
    6. Multi-color Progress Bar
    7. Gradient Progress Bar
    8. Swiper Progress Bar
    9. On Scroll Progress Bar
    10. Color Changing Upload Progress Bar
    11. Circular Progress Bars
    12. Simple Clean Progress Bars
    13. Simple Dynamic Progress Bar
    14. Stepper Progress Bar
    15. Basic Progress Bar with Rounded Edges
    16. Slim Progress Bar with Sharp Edges
  4. Customize the Progress Bar
  5. Final Thoughts and Conclusion

Why Progress Bar Matters?

The significance of a progress bar in web development cannot be overstated. 📊 It serves as a visual indicator, providing users with real-time feedback about the status of a process or task. This element enhances user experience by reducing uncertainty and keeping them engaged.

When users encounter a progress bar, they gain a sense of control and are more likely to stay on a webpage or application. It communicates transparency and professionalism, instilling confidence in the system's reliability.

Moreover, a well-designed progress bar can significantly improve accessibility, aiding users with disabilities in understanding and navigating through the content. This inclusivity is a vital aspect of modern web development.

In essence, a progress bar is not just a visual element; it's a user-centric tool that adds functionality, clarity, and sophistication to a webpage. It reflects a developer's commitment to providing an intuitive and seamless experience for visitors.

What does a progress bar do?

A progress bar is a graphical user interface (GUI) element that visually represents the progress of a task or process. 📊 It conveys to users the status and completion percentage of an ongoing operation, providing them with real-time feedback.

Essentially, a progress bar serves three primary functions:

  1. Visual Feedback: It offers a clear and immediate indication of how far along a process has come and how much is left to complete. This visual representation helps users understand the progress intuitively.
  2. Enhanced User Experience: Progress bars improve user experience by reducing uncertainty and frustration. They keep users engaged and informed, preventing them from becoming impatient or confused during longer processes.
  3. Transparency and Reliability: By showing the progress of an operation, a progress bar instills confidence in users about the system's reliability and responsiveness. It assures them that their action has been acknowledged and is being processed.

In summary, a progress bar is a crucial UI element that contributes significantly to the overall usability and functionality of a website or application. It empowers users by keeping them informed and in control of their interactions.

Types of Progress Bars with examples

Certainly! There are several types of progress bars that can be implemented in HTML, each tailored to specific visual styles and usage scenarios. Let's explore some of the most commonly used ones:

🔄 Animated Progress Bar

An animated progress bar is a moving visual element on a webpage that shows the ongoing progress of a task. Unlike static bars, which stay still, animated ones provide real-time feedback, making it clear that something is happening. They're used for tasks like loading pages or uploading files, enhancing the user experience by adding a dynamic element to the interface.

🔄 Animated Progress Bar

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Animated Progress Bar</title>
<style>
.progress-container {
width: 100%;
height: 30px;
background-color: #f0f0f0;
}
.progress-bar {
width: 0%;
height: 100%;
background-color: #3614ce;
animation: progressAnimation 20s linear infinite; /* Animation for progress */
}
@keyframes progressAnimation {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
</body>
</html>

➖ Straight Progress Bar

A "Straight Progress Bar" is a linear visual element often seen on websites and apps that fills gradually to show the progress of a task, making it easy for users to see how far along a process has come. It's a straightforward way to provide real-time feedback about the completion status of an operation.

➖ Straight Progress Bar
Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Straight Progress Bar</title>
<style>
.progress-container {
width: 100%;
height: 30px;
background-color: #f0f0f0;
}
.progress-bar {
width: 0%;
height: 100%;
background-color: #3614ce;
transition: width 0.5s; /* Smooth animation */
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update the progress bar
const progressBar = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
progressBar.style.width = progress + "%";
setTimeout(updateProgressBar, 800); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

🔄 Animated Circular Progress Bars

Animated Circular Progress Bars are circular-shaped visual elements that fill or rotate to represent the progress of a task. They offer an engaging and dynamic way to show completion status in web and app interfaces, often used for tasks that require time to finish.

🔄 Animated Circular Progress Bars

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Animated Circular Progress Bar</title>
<style>
.progress-container {
width: 100px;
height: 100px;
position: relative;
}
.progress-circle {
width: 100%;
height: 100%;
background: conic-gradient(#3614ce 0%, #3614ce 25%, transparent 25%, transparent 100%);
border-radius: 50%;
animation: spin 2s linear infinite; /* Adjust the animation duration as needed */
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-circle"></div>
</div>
</body>
</html>

📏 Vertical Progress Bars

Vertical Progress Bars are visual elements that depict the progress of a task in a top-to-bottom manner. They're used to represent completion status in a vertical orientation, often in situations where horizontal space is constrained or when a vertical progression is more intuitive for users to grasp, such as in multi-step processes or constrained layouts.

📏 Vertical Progress Bars

Example 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vertical Progress Bar</title>
<style>
.progress-container {
width: 100px;
height: 300px; /* Adjust the height as needed */
background-color: #f0f0f0;
position: relative;
}
.progress-bar {
width: 100%;
height: 0%;
background-color: #3614ce;
position: absolute;
bottom: 0;
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update the progress bar
const progressBar = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
progressBar.style.height = progress + "%";
setTimeout(updateProgressBar, 500); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

🌡️ Thermometer Progress Bar

A Thermometer Progress Bar is a graphic element that looks like a thermometer and fills from the bottom to the top to show progress. It's commonly used for fundraising or donation goals and makes progress tracking visually intuitive, resembling filling a real thermometer.

🌡️ Thermometer Progress Bar

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Thermometer Progress Bar</title>
<style>
.thermometer-container {
width: 60px;
height: 300px; /* Adjust the height as needed */
background-color: #f0f0f0;
position: relative;
}
.thermometer-liquid {
width: 100%;
height: 0%;
background-color: #3614ce;
position: absolute;
bottom: 0;
}
</style>
</head>
<body>
<div class="thermometer-container">
<div class="thermometer-liquid" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update the progress bar
const liquid = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
liquid.style.height = progress + "%";
setTimeout(updateProgressBar, 500); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

🌈 Multi-color Progress Bar

A Multi-color Progress Bar is a visual element that uses different colors to represent various stages or milestones within a task or process. This helps users quickly identify different phases of the progression, making it useful for complex processes with multiple steps.

🌈 Multi-color Progress Bar

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Multi-color Progress Bar</title>
<style>
.progress-container {
width: 100%;
height: 30px;
background-color: #f0f0f0;
}
.progress-bar {
width: 0%;
height: 100%;
background: linear-gradient(45deg, #ff5733, #ffdb58, #33ff57); /* Gradient with multiple colors */
transition: width 0.5s; /* Smooth animation */
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update the progress bar
const progressBar = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
progressBar.style.width = progress + "%";
setTimeout(updateProgressBar, 500); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

ğŸŽ¨ Gradient Progress Bar

A Gradient Progress Bar is a visual element that displays progress using a smooth color transition along the length of the bar. It's a stylish way to show completion status in web and app interfaces, adding visual appeal and sophistication to progress tracking.

ğŸŽ¨ Gradient Progress Bar

Example

 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Gradient Progress Bar</title>
<style>
.progress-container {
width: 100%;
height: 30px;
background-color: #f0f0f0;
position: relative;
}
.progress-bar {
width: 0%;
height: 100%;
background: linear-gradient(to right, #3614ce, #fdd835, #e53935); /* Gradient colors */
transition: width 0.5s; /* Smooth animation */
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update the progress bar
const progressBar = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
progressBar.style.width = progress + "%";
setTimeout(updateProgressBar, 500); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

🔄 Swiper Progress Bar

The Swiper Progress Bar is a feature in the Swiper.js library used to create responsive and touch-friendly sliders or carousels in web and mobile apps. It displays a moving horizontal bar to indicate the progress of slides as users navigate through content, making it ideal for image galleries and interactive presentations. It's highly customizable to fit different design needs.

🔄 Swiper Progress Bar

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Swiper Progress Bar</title>
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
</head>
<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
</div>
<!-- Add Swiper Navigation -->
<div class="swiper-pagination"></div>
</div>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<script>
var swiper = new Swiper(".swiper-container", {
pagination: {
el: ".swiper-pagination",
type: "progressbar", // Use progress bar as pagination
},
});
</script>
</body>
</html>

🔄 On Scroll Progress Bar

An On Scroll Progress Bar is a visual element that appears as users scroll down a webpage, showing how much of the content they've viewed. It provides an interactive indicator of their progress and is commonly used in long-scrolling and storytelling websites to improve user navigation and engagement.

🔄 On Scroll Progress Bar

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>On Scroll Progress Bar</title>
<style>
body {
height: 2000px; /* To create enough scrollable content for demonstration */
}
#progress-container {
width: 100%;
height: 5px;
background-color: #f0f0f0;
position: fixed;
top: 0;
left: 0;
}
#progress-bar {
width: 0;
height: 100%;
background-color: #3614ce;
}
</style>
</head>
<body>
<div id="progress-container">
<div id="progress-bar"></div>
</div>
<script>
window.addEventListener("scroll", function () {
const progressBar = document.getElementById("progress-bar");
const totalHeight = document.body.scrollHeight - window.innerHeight;
const scrollProgress = (window.scrollY / totalHeight) * 100;
progressBar.style.width = scrollProgress + "%";
});
</script>
</body>
</html>

🌈 Color Changing Upload Progress Bar

A Color Changing Upload Progress Bar is a visual element that alters its color or style to show different stages of a file upload process. It starts with one color, changes as the upload progresses, and may turn a different color if an error occurs. This dynamic feedback enhances the user experience and helps users quickly understand the upload's status, commonly used in file-sharing platforms and web apps for clear progress indication.

🌈 Color Changing Upload Progress Bar

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Color Changing Upload Progress Bar</title>
<style>
.progress-container {
width: 100%;
height: 30px;
background-color: #f0f0f0;
}
.progress-bar {
width: 0%;
height: 100%;
background-color: #3498db; /* Initial blue color */
transition: width 0.5s; /* Smooth animation */
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update and change the progress bar color
const progressBar = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
progressBar.style.width = progress + "%";
// Change the color when the progress reaches 50%
if (progress >= 50) {
progressBar.style.backgroundColor = "#e74c3c"; // Red color
}
setTimeout(updateProgressBar, 500); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

⭕ Circular Progress Bars

Circular Progress Bars are visual elements that represent task progress in a circular shape, filling up gradually as the task advances. They are commonly used in web and mobile interfaces to make progress tracking engaging and visually appealing.

⭕ Circular Progress Bars

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Circular Progress Bar</title>
<style>
.progress-container {
width: 100px;
height: 100px;
position: relative;
}
.progress-circle {
width: 100%;
height: 100%;
border: 10px solid #f0f0f0; /* Gray circle */
border-top: 10px solid #3614ce;
border-radius: 50%;
animation: spin 2s linear infinite; /* Rotate the circle */
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-circle"></div>
</div>
</body>
</html>

📏 Simple Clean Progress Bars

Simple Clean Progress Bars are basic, no-nonsense visual elements used in web and app interfaces to show task progress in a clear and straightforward manner, without any fancy animations or decorations. They prioritize simplicity and clarity for users to easily understand completion status.

📏 Simple Clean Progress Bars

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Simple Clean Progress Bar</title>
<style>
.progress-container {
width: 100%;
height: 30px;
background-color: #f0f0f0;
}
.progress-bar {
width: 0%;
height: 100%;
background-color: #3614ce;
transition: width 0.5s; /* Smooth animation */
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update the progress bar
const progressBar = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
progressBar.style.width = progress + "%";
setTimeout(updateProgressBar, 500); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

🔄 Simple Dynamic Progress Bar

A Simple Dynamic Progress Bar is a visual element in web and app interfaces that updates in real-time to show the progress of a task, like file uploads or downloads. It provides immediate feedback to users and adds interactivity to the user experience.

🔄 Simple Dynamic Progress Bar

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Simple Dynamic Progress Bar</title>
<style>
.progress-container {
width: 100%;
height: 30px;
background-color: #f0f0f0;
}
.progress-bar {
width: 0%;
height: 100%;
background-color: #3614ce;
transition: width 0.5s; /* Smooth animation */
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to simulate dynamic progress
const progressBar = document.getElementById("myProgressBar");
function simulateDynamicProgress() {
let progress = 0;
const interval = setInterval(() => {
if (progress < 100) {
progress += Math.random() * 5; // Simulate variable progress (adjust as needed)
progressBar.style.width = progress + "%";
} else {
clearInterval(interval);
}
}, 500); // Update every 500 milliseconds (adjust as needed)
}
// Call the function to start simulating dynamic progress
simulateDynamicProgress();
</script>
</body>
</html>

🚶 Stepper Progress Bar

A Stepper Progress Bar is a visual element that breaks a multi-step task into clear and sequential stages, guiding users through each step. It's often used in forms and multi-page processes to improve user understanding of progress and reduce errors.

🚶 Stepper Progress Bar

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Stepper Progress Bar</title>
<style>
.stepper {
display: flex;
justify-content: space-between;
width: 300px;
margin: 20px auto;
}
.step {
width: 30px;
height: 30px;
background-color: #ccc;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
}
.active {
background-color: #3614ce;
color: #fff;
}
</style>
</head>
<body>
<div class="stepper">
<div class="step active">1</div>
<div class="step">2</div>
<div class="step">3</div>
</div>
</body>
</html>

➰ Basic Progress Bar with Rounded Edges

A Basic Progress Bar with Rounded Edges is a visual element that displays task progress with a modern and softened appearance due to its rounded edges. It combines functionality with a more stylish design for a user-friendly and contemporary look.

➰ Basic Progress Bar with Rounded Edges

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Basic Progress Bar with Rounded Edges</title>
<style>
.progress-container {
width: 100%;
height: 30px;
background-color: #f0f0f0;
border-radius: 15px; /* Rounded edges */
overflow: hidden;
}
.progress-bar {
width: 0%;
height: 100%;
background-color: #3614ce;
border-radius: 15px; /* Match the container's rounded edges */
transition: width 0.5s; /* Smooth animation */
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update the progress bar
const progressBar = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
progressBar.style.width = progress + "%";
setTimeout(updateProgressBar, 500); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

➖ Slim Progress Bar with Sharp Edges

A Slim Progress Bar with Sharp Edges is a minimalistic and modern visual element used to show task progress. It has a sleek appearance with straight, sharp edges, providing a clean and contemporary look while indicating completion status.

➖ Slim Progress Bar with Sharp Edges

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Slim Progress Bar with Sharp Edges</title>
<style>
.progress-container {
width: 100%;
height: 10px;
background-color: #f0f0f0;
border-radius: 0; /* No rounded edges */
overflow: hidden;
}
.progress-bar {
width: 0%;
height: 100%;
background-color: #3614ce;
border-radius: 0; /* No rounded edges */
transition: width 0.5s; /* Smooth animation */
}
</style>
</head>
<body>
<div class="progress-container">
<div class="progress-bar" id="myProgressBar"></div>
</div>
<script>
// JavaScript to update the progress bar
const progressBar = document.getElementById("myProgressBar");
let progress = 0;
function updateProgressBar() {
if (progress < 100) {
progress += 5; // Increase the progress by 5% (you can adjust this value)
progressBar.style.width = progress + "%";
setTimeout(updateProgressBar, 500); // Update every 500 milliseconds (adjust as needed)
}
}
// Call the function to start updating the progress bar
updateProgressBar();
</script>
</body>
</html>

Customize the Progress Bar

Customizing a progress bar means making it look and behave the way you want it to. It's about changing its appearance, color, animation, and style to match your website or app's design and functionality, ultimately enhancing the user experience and adding a personal touch to the progress indicator.

Final Thoughts and Conclusion

In conclusion, creating a stunning progress bar in HTML is a valuable skill for web developers looking to improve user experience and add a touch of style to their projects. By understanding the various types of progress bars, such as straight, animated circular, vertical, thermometer, multi-color, and gradient progress bars, you can choose the one that best suits your design needs. Additionally, the ability to customize the progress bar's appearance and behavior allows you to tailor it to your project's unique requirements. Whether you opt for a sleek and modern design or a more minimalistic approach, a well-crafted progress bar enhances user engagement and provides clear feedback on task completion, contributing to a more polished and user-friendly web application.