The progress bar is an important element in the web, the progress bar can be used for downloading, marks obtained, skill measuring unit, etc. To create a progress bar we can use HTML and CSS. To make that progress bar responsive you will need JavaScript.
In this article, we will learn to create progress bars using HTML and CSS. A progress bar is created by using two HTML “div”, the container (parent div), and the skill (child div) as shown in the following examples.
Example 1: We will divide the article into two coding sections, in the first section we will work on HTML, and in the second section will design that progress bar.
- HTML Code: We create a parent div that will define the full length unit and the child div will define the obtain unit.
<!DOCTYPE html>
< html >
< head >
< title >Design a Progress bar</ title >
</ head >
< body >
< h1 >My Skills</ h1 >
< p >HTML</ p >
< div class = "container" >
< div class = "skill html" >80%</ div >
</ div >
< p >PHP</ p >
< div class = "container" >
< div class = "skill php" >60%</ div >
</ div >
</ body >
</ html >
|
- CSS Code: By using CSS we will decorate both the div, colored the full and obtain unit. Set the length of the divs also.
<style>
p {
font-size : 20px ;
}
.container {
background-color : rgb ( 192 , 192 , 192 );
width : 80% ;
border-radius: 15px ;
}
.skill {
background-color : rgb ( 116 , 194 , 92 );
color : white ;
padding : 1% ;
text-align : right ;
font-size : 20px ;
border-radius: 15px ;
}
.html {
width : 80% ;
}
.php {
width : 60% ;
}
</style>
|
Final Code: Here we will combine the above two coding section.
<!DOCTYPE html>
< html >
< head >
< style >
p {
font-size: 20px;
}
.container {
background-color: rgb(192, 192, 192);
width: 80%;
border-radius: 15px;
}
.skill {
background-color: rgb(116, 194, 92);
color: white;
padding: 1%;
text-align: right;
font-size: 20px;
border-radius: 15px;
}
.html {
width: 80%;
}
.php {
width: 60%;
}
</ style >
</ head >
< body >
< h1 >My Skills</ h1 >
< p >HTML</ p >
< div class = "container" >
< div class = "skill html" >80%</ div >
</ div >
< p >PHP</ p >
< div class = "container" >
< div class = "skill php" >60%</ div >
</ div >
</ body >
</ html >
|
Output:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
22 Jul, 2020
Like Article
Save Article