"Bootstrap 5 Process Steps Responsive"
Bootstrap 4.1.1 Snippet by ozki

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css" integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous"> <h1 class="text-center">Bootstrap 5 Process Steps</h1> <a href="https://youtu.be/EaW1mPg7FWA">You can watch youtube video explaining how it's done!</a> <section> <div class="container"> <div class="accordion" id="accordionExample"> <div class="steps"> <progress id="progress" value=0 max=100 ></progress> <div class="step-item"> <button class="step-button text-center" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> 1 </button> <div class="step-title"> First Step </div> </div> <div class="step-item"> <button class="step-button text-center collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> 2 </button> <div class="step-title"> Second Step </div> </div> <div class="step-item"> <button class="step-button text-center collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> 3 </button> <div class="step-title"> Third Step </div> </div> </div> <div class="card"> <div id="headingOne"> </div> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample"> <div class="card-body"> <div class="text-center"> <a href="https://codepen.io/ouzkagan/pen/mdPyNMB?editors=1010">https://codepen.io/ouzkagan/pen/mdPyNMB?editors=1010</a></div> beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> <div class="card"> <div id="headingTwo"> </div> <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample"> <div class="card-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> <div class="card"> <div id="headingThree"> </div> <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample"> <div class="card-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. </div> </div> </div> </div> </div> </section> <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"></script>
:root { --prm-color: #0381ff; --prm-gray: #b1b1b1; } body { height: 100vh; display: flex; align-items: center; justify-content: space-evenly; flex-direction:column; } section{ width:100%; } .steps { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; position: relative; } .step-button { width: 50px; height: 50px; border-radius: 50%; border: none; background-color: var(--prm-gray); transition: .4s; } .step-button[aria-expanded="true"] { width: 60px; height: 60px; background-color: var(--prm-color); color: #fff; } .done { background-color: var(--prm-color); color: #fff; } .step-item { z-index: 10; text-align: center; } #progress { position: absolute; width: 95%; z-index: 5; height: 10px; margin-left: 18px; margin-bottom: 18px; } /* to customize progress bar */ #progress::-webkit-progress-value { background-color: var(--prm-color); transition: .2s ease; } #progress::-webkit-progress-bar { background-color: var(--prm-gray); }
const stepButtons = document.querySelectorAll('.step-button'); const progress = document.querySelector('#progress'); Array.from(stepButtons).forEach((button,index) => { button.addEventListener('click', () => { progress.setAttribute('value', index * 100 /(stepButtons.length - 1) );//there are 3 buttons. 2 spaces. stepButtons.forEach((item, secindex)=>{ if(index > secindex){ item.classList.add('done'); } if(index < secindex){ item.classList.remove('done'); } }) }) })

Related: See More


Questions / Comments: