Circular Progress Bar using only HTML and CSS

0

Circular Progress Bar is a popular web element that is mainly used on business or personal websites. If you want to create a circular progress bar using HTML and CSS, then this article will help you. Here I am going to show you how to make a simple CSS circle progress bar.

This type of animation is used to show qualifications, experience, etc. on different types of personal websites. Undoubtedly it enhances the quality and beauty of the website a lot.

Circular Progress Bar using only HTML and CSS

Here you can set custom values ​​to your liking. When you load the page, this animation will go from zero to your assigned meaning. A percentage of text is used here, but no animation is used in this text. It is made in a very simple way. First, the standard set for color animation is divided into two parts. Then animation was added to it with the help of CSS code. 

Circular Progress Bar

In this article, I will show you step by step how I made this circular progress bar design. There is no reason to worry if you are a beginner. But to make it, you need to have an idea about basic HTML and CSS.

Below the article, I have given a download button where you can get the required source code. So let's take a look at the tutorial on how to make this CSS circular progress bar.

See the Pen Circular Progress Bar using HTML CSS by Raj Template (@RajTemplate) on CodePen.


To create this program I first designed something from a web page. Designing only means setting the background color and font of the webpage.


body {
  font-family: "Roboto", sans-serif;
  background:#d2eaf1;
}


Step 1: The basic structure of Circular Progress Bar

I have used HTML and CSS to create the basic structure of the Circular Progress Bar. I have created a small circle on the webpage. The width and height of this circle are 150 px. The background color of the circle is white and margins are used to place it in the middle.


<div class="circle-wrap">
  <div class="circle">
 
  </div>
</div>


.circle-wrap {
  margin: 150px auto;
  width: 150px;
  height: 150px;
  background: #fefcff;
  border-radius: 50%;
  border: 1px solid #cdcbd0;
}


The basic structure of Circular Progress Bar

Step 2: Half of the simple CSS circle progress bar

As I said before, the animation in this circle is divided into two parts. This means that the animation has been divided into two parts up to the customer value.

I have made the first part of those two parts. Width and height 150 have been used to make this animation equal in size to the Circular Progress Bar. Similarly, border-radius 50% has been used to make it round. Here I have set the background-color to blue. If you want to play an animation in another color, you can use that color here.


<div class="mask half">
    <div class="fill"></div>
</div>


.circle-wrap .circle .mask,
.circle-wrap .circle .fill {
  width: 150px;
  height: 150px;
  position: absolute;
  border-radius: 50%;
}
 
.mask .fill {
  clip: rect(0px, 75px, 150px, 0px);
  background-color: #227ded;
}


Half of the simple CSS circle progress bar

Step 3: The other half of the Circular Progress Bar

Now I have designed the other half of the Circular Progress Bar. I set the time to three seconds by adding animation here. This means that when this page is opened, the animation will take 3 seconds to reach the meaning you set from zero.

Here 135 degrees have been used using transform. This transform will determine where the animation will end in this circle. 


We know that a circle is formed by 360. Since here we have divided the CSS circle progress bar into two parts, so each part is 180 degrees. 

Here we have set a 135-degree animation for each part using Transform. So it will be 270 degrees for the total circle. Here I want to increase the animation to 75% so I have used 270 degrees.

(360/100) * 75 = 270

You determine the value of this degree according to your needs. For example, if you want the animation of the Circular Progress Bar will be up to 80%. But for that, you have to use 144 degrees here. Lastly, I have implemented this animation using @keyframes.


<div class="mask full">
   <div class="fill"></div>
</div>


.circle-wrap .circle .mask {
  clip: rect(0px, 150px, 150px, 75px);
}
 
.mask.full,
.circle .fill {
  animation: fill ease-in-out 3s;
  transform: rotate(135deg);
}
  
@keyframes fill{
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(135deg);
  }
}


The other half of the Circular Progress Bar

Step 4: Create a percentage in the Circular Progress Bar

Now I have added percentages in this circular progress bar. Although that percentage of animation is not added. Added text using basic HTML and CSS code. I have used text-align: center and position: absolute to place the text in the middle of the Circular Progress Bar. I used border-radius: 50% to make its background width and height 122 px and round. Here I have used font-size: 2em to make the size of the text smaller and larger.


<div class="inside-circle"> 75% </div>


.circle-wrap .inside-circle {
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background: #d2eaf1;
  line-height: 120px;
  text-align: center;
  margin-top: 14px;
  margin-left: 14px;
  color: #1e51dc;
  position: absolute;
  z-index: 100;
  font-weight: 700;
  font-size: 2em;
}



Circular Progress Bar

 As you can see in the picture above, now this CSS Circular Progress Bar is absolutely ready. Hope you find out from this article how I created this Circular Progress Bar using HTML and CSS.

I have already created many more such designs using JavaScript and JQuery. Below I have given a download button where you can get the source code required to create this simple CSS circle progress bar.







Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)
To Top