SG - Stepper

by Corentin Ballot

HTML

<ol class="dsg_m_stepper">
  <li class="dsg_m_stepper_item active">
    <h1>Je fais une</h1>
    <p>dès maintenant</p>
    <label class="dsg_m_stepper_next_indicator">votre prochaine étape</label>
  </li>
  <li class="dsg_m_stepper_item">
    <h1>Je fais une simulation</h1>
    <p>dès maintenant</p>
    <label class="dsg_m_stepper_next_indicator">votre prochaine étape</label>
    </li>
  <li class="dsg_m_stepper_item">
    <h1>Je fais une simulation</h1>
    <p>dès maintenant</p>
    <label class="dsg_m_stepper_next_indicator">votre prochaine étape</label>
    </li>
  <li class="dsg_m_stepper_item">
    <h1>Je fais une simulation</h1>
    <p>dès maintenant</p>
    <label class="dsg_m_stepper_next_indicator">votre prochaine étape</label>
    </li>
</ol>

CSS

.dsg_m_stepper {
  width: 100%;
  box-sizing: border-box;
  list-style:none;
  padding: 0;
  text-align: center;
  display: flex;
   justify-content: center;
}

 .dsg_m_stepper_item {
  counter-increment: stepper-step;
  display:inline-block;
  width: 284px;
  position: relative;
  z-index: 5;
}
  
 .dsg_m_stepper_item::before {
   content:counter(stepper-step);
   width: 80px;
   height: 80px;
   display:block;
   margin:0 auto 1rem;
   border-radius: 80px;
   border: 8px solid rgb(119,57,194);
   font-size: 40px;
   line-height: 80px;
   font-family: Montserrat;
   font-weight: 800;
   z-index: 0;
   background-color: white;
    position: relative;
 }
 
.dsg_m_stepper_item.active ~ .dsg_m_stepper_item::before {
  border-color: rgb(184,184,204);
}
  
 .dsg_m_stepper_item::after {
   content: "";
   width: 235px;
   height: 8px;
   position: absolute;
   top: 44px;
   background-color: rgb(119,57,194);
   z-index: 0;
   right: -135px;
 }
 
 .dsg_m_stepper_item.active ~ .dsg_m_stepper_item::after {
   background-color: rgb(184,184,204);
 }
 
 .dsg_m_stepper_item:last-child::after {
   content: none;
 }
 
.dsg_m_stepper_next_indicator {
  visibility: hidden;
}
 
.dsg_m_stepper_item.active + .dsg_m_stepper_item > .dsg_m_stepper_next_indicator {
  visibility: visible;
}