Minimalist Stepper - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Minimalist Stepper</title> <style> body { font-family: 'Arial', sans-serif; background-color: #f0f0f0; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .stepper { display: flex; position: relative; margin: 20px 0; } .step { position: relative; width: 80px; height: 80px; background-color: #fff; border: 2px solid #ddd; display: flex; justify-content: center; align-items: center; color: #555; font-size: 1.5em; border-radius: 50%; transition: transform 0.3s ease-in-out; } .step.active { background-color: #007bff; color: #fff; transform: scale(1.2); border-color: #007bff; } .step.complete { background-color: #28a745; color: #fff; border-color: #28a745; transform: scale(1); } .step .icon { font-size: 2em; } .step .number { font-size: 1.2em; } .line { position: absolute; top: 50%; left: 40px; width: calc(100% - 160px); height: 3px; background-color: #ddd; z-index: -1; } .step:hover { cursor: pointer; transform: scale(1.1); } </style> </head> <body> <div class="stepper"> <div class="step active" data-step="1"> <div class="number">1</div> </div> <div class="line"></div> <div class="step" data-step="2"> <div class="number">2</div> </div> <div class="line"></div> <div class="step" data-step="3"> <div class="number">3</div> </div> </div> <script> const steps = document.querySelectorAll('.step'); let currentStep = 1; steps.forEach(step => { step.addEventListener('click', () => { const stepNumber = parseInt(step.getAttribute('data-step')); if (stepNumber <= currentStep + 1) { steps.forEach((s, index) => { s.classList.remove('active'); s.classList.remove('complete'); if (index < stepNumber - 1) { s.classList.add('complete'); } }); step.classList.add('active'); currentStep = stepNumber; } }); }); </script> </body> </html>