Skip to content Skip to sidebar Skip to footer

Drawing A Tick Mark In The Progressbar If The Process Is Done

I was created a simple progressbar with CSS & HTML. Here I used three classes active, inactive & done. If the class is active it will show the circle with background-colo

Solution 1:

Use tick mark in content: "✓";

.container {
      width: 600px;
      margin: 100px auto; 
  }
  .progressbar li {
      list-style-type: none;
      width: 25%;
      float: left;
      font-size: 12px;
      position: relative;
      text-align: center;
      color: #7d7d7d;
  }
  .progressbar li:before {
      width: 30px;
      height: 30px;
      content: "";
      line-height: 30px;
      border: 2px solid #7d7d7d;
      display: block;
      text-align: center;
      margin: 0 auto 10px auto;
      border-radius: 50%;
      background-color: white;
  }
  .progressbar li.done:before {
      content: "✓";
      color: #ffffff;
      font-size: 20px;
  }
  .progressbar li:after {
      width: 100%;
      height: 2px;
      content: '';
      position: absolute;
      background-color: #7d7d7d;
      top: 15px;
      left: -50%;
      z-index: -1;
  }
  .progressbar li:first-child:after {
      content: none;
  }
  .progressbar li.active {
      color: green;
  }
  .progressbar li.active:before {
      border-color: #55b776;
      background-color: #55b776;
  }
  .progressbar li.active + li:after {
      background-color: #55b776;
  }
  .progressbar li.done:before {
      border-color: #55b776;
      background-color: #55b776;
  }
  .progressbar li.done + li:after {
      background-color: #55b776;
  }
  .progressbar li.inactive:before {
      border-color: #7d7d7d;
      background-color: #7d7d7d;
  }
  .progressbar li.inactive + li:after {
      background-color: #7d7d7d;
  }
<div class="container">
  <ul class="progressbar">
      <li class="done"></li>
      <li class="active"></li>
      <li class="inactive"></li>
  </ul>
</div> 

As per your Requirements using css

.container {
      width: 600px;
      margin: 100px auto; 
  }
  .progressbar li {
      list-style-type: none;
      width: 25%;
      float: left;
      font-size: 12px;
      position: relative;
      text-align: center;
      color: #7d7d7d;
  }
  .progressbar li:before {
      width: 30px;
      height: 30px;
      content: "";
      line-height: 30px;
      border: 2px solid #7d7d7d;
      display: block;
      text-align: center;
      margin: 0 auto 10px auto;
      border-radius: 50%;
      background-color: white;
  }
  .progressbar li:after {
      width: 100%;
      height: 2px;
      content: '';
      position: absolute;
      background-color: #7d7d7d;
      top: 15px;
      left: -50%;
      z-index: -1;
  }
  .progressbar li:first-child:after {
      content: none;
  }
  .progressbar li.active {
      color: green;
  }
  .progressbar li.active:before {
      border-color: #55b776;
      background-color: #55b776;
  }
  .progressbar li.active + li:after {
      background-color: #55b776;
  }
  .progressbar li.done:before {
      border-color: #55b776;
      background-color: #55b776;
  }
  .progressbar li.done + li:after {
      background-color: #55b776;
  }
  .progressbar li.inactive:before {
      border-color: #7d7d7d;
      background-color: #7d7d7d;
  }
  .progressbar li.inactive + li:after {
      background-color: #7d7d7d;
  }
  
  .progressbar li.done {
    font-size: 16px;
    position: relative;
  }

  .progressbar li.done:after {
    content: " ";
    display: block;
    width: 0.3em;
    height: 0.6em;
    border: solid white;
    border-width: 0 0.2em 0.2em 0;
    position: absolute;
    left: 4.2em;
    top: 26%;
    margin-top: -0.2em;
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    z-index:9;
    background-color: #55b776;
  }
<div class="container">
  <ul class="progressbar">
    <li class="done"></li>
    <li class="active"></li>
    <li class="inactive"></li>
  </ul>
</div>

Solution 2:

You only need to set the content to the tick mark when the done class is applied.

.progressbar li.done:before {
    content: "✔";
}

Wirking fiddle: https://jsfiddle.net/ordmpf59/


Post a Comment for "Drawing A Tick Mark In The Progressbar If The Process Is Done"