Responsive horizontal step indicator in Bootstrap 5.3
25/10/2025 · Code Snippets
Creating a clean, responsive step indicator is a common requirement in multi-step forms, onboarding flows, and checkout processes. Bootstrap 5.3 makes this simple to implement with modern Flexbox utilities and custom styling.
Below is a fully responsive horizontal step indicator that works seamlessly with Bootstrap 5.3. It visually represents progress through steps, with clear differentiation between completed, active, and upcoming steps.
Demo – Stepper with bootstrap
How It Works
- The
.steppercontainer usesdisplay: flexfor a responsive horizontal layout. - Each
.steprepresents a single progress point and flexes evenly across the container. - The
::beforepseudo-element creates the connecting line between steps. - The
.completedand.activeclasses dynamically change the step’s color and status, making it visually clear which steps are done and which one is currently active.
The HTML code
<div class="stepper">
<div class="step completed">
<div class="step-number">1</div>
<div class="step-label">Step 1</div>
</div>
<div class="step completed">
<div class="step-number">2</div>
<div class="step-label">Step 2</div>
</div>
<div class="step active">
<div class="step-number">3</div>
<div class="step-label">Step 3</div>
</div>
<div class="step">
<div class="step-number">4</div>
<div class="step-label">Step 4</div>
</div>
</div>
The CSS code
.stepper {
display: flex;
justify-content: space-between;
position: relative;
margin: 40px 0;
}
.step {
text-align: center;
position: relative;
flex: 1;
}
.step::before {
content: '';
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
height: 4px;
width: 100%;
background-color: var(--bs-secondary);
z-index: 0;
}
.step-number {
position: relative;
z-index: 1;
display: inline-block;
width: 40px;
height: 40px;
line-height: 40px;
border-radius: 50%;
background-color: var(--bs-secondary);
color: var(--bs-light);
font-weight: 600;
}
.step.active .step-number {
background-color: var(--bs-primary);
color: var(--bs-light);
}
.step.completed .step-number {
background-color: var(--bs-success);
color: var(--bs-light);
}
.step-label {
margin-top: 10px;
font-size: 0.9rem;
color: var(--bs-secondary);
}
.step.active .step-label {
color: var(--bs-primary);
font-weight: 600;
}