CSS Counter

by Santosh Thakur

HTML

<div class="container">
  <ul class="progressBar">
    <li>Step 1</li>
    <li>Step 2</li>
    <li>Step 3</li>
  </ul>
</div>

CSS

.container {
  width: 100%;
}

.progressBar {
  counter-reset: step;
}

.progressBar li {
  list-style-type: none;
  float: left;
  text-align: center;
  position: relative;
  width: 33.3%;
}

.progressBar li:before {
  content: counter(step);
  counter-increment:step;
  width: 30px;
  height: 30px;
  line-height: 30px;
  display: block;
  border: 1px solid #333;
  background: #fff;
   text-align: center;
   margin: 0 auto;
   border-radius: 50%;
}

.progressBar li:after {
  content: '';
  position: absolute;
  height: 1px;
  width: 100%;
  left: -50%;
  top: 15px;
  z-index: -1;
  background: #333;
}

.progressBar li:first-child:after {
  content: none;
  
}