Minimalist Multi Step Form - 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 Multi-step Form</title> <style> body { font-family: 'Helvetica', sans-serif; background: #F7F7F7; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; overflow: hidden; } .form-container { background: #fff; padding: 20px; border-radius: 5px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); width: 350px; max-width: 100%; transition: all 0.3s ease; overflow: hidden; } .form-container h1 { margin: 0 0 20px; font-size: 22px; text-align: center; color: #333; } .form-container .form-step { display: none; transition: all 0.3s ease; } .form-container .form-step.active { display: block; } .form-container .form-step input { width: 95%; padding: 10px; margin: 10px 0; border: 1px solid #ddd; border-radius: 3px; outline: none; } .form-container .form-step .step-icon { font-size: 30px; text-align: center; color: #2D2D2D; } .form-container .form-step .emoji { font-size: 20px; text-align: center; } .form-container .form-step .form-controls { text-align: center; margin-top: 15px; } .form-container .form-step .form-controls button { padding: 10px 20px; border: none; border-radius: 3px; background: #2D2D2D; color: white; cursor: pointer; transition: background 0.3s ease; } .form-container .form-step .form-controls button:hover { background: #1A1A1A; } .form-container .progress-bar { position: relative; display: flex; justify-content: space-between; margin-bottom: 20px; } .form-container .progress-bar .step { width: 15px; height: 15px; background: #ddd; border-radius: 50%; position: relative; } .form-container .progress-bar .step::before { content: ''; position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; background: inherit; transform: translate(-50%, -50%); border-radius: inherit; transition: background 0.3s ease; } .form-container .progress-bar .step.active::before { background: #2D2D2D; } .form-container .progress-bar::after { content: ''; position: absolute; top: 50%; left: 7%; width: 86%; height: 1px; background: #ddd; z-index: -1; } .form-container .progress-bar .step.active + .step::after { background: #2D2D2D; } .form-container .form-step .form-controls .prev-btn { background: #bbb; margin-right: 10px; } .form-container .form-step .form-controls .prev-btn:hover { background: #999; } h2, p{ text-align: center; } </style> </head> <body> <div class="form-container"> <h1>Minimalist Multi-step Form ⚪️</h1> <div class="progress-bar"> <div class="step"></div> <div class="step"></div> <div class="step"></div> <div class="step"></div> </div> <form id="minimalist-multi-step-form"> <div class="form-step active"> <div class="step-icon">👤</div> <input type="text" placeholder="First Name" required> <input type="text" placeholder="Last Name" required> <div class="form-controls"> <button type="button" class="next-btn">Next</button> </div> </div> <div class="form-step"> <div class="step-icon">📧</div> <input type="email" placeholder="Email Address" required> <div class="form-controls"> <button type="button" class="prev-btn">Previous</button> <button type="button" class="next-btn">Next</button> </div> </div> <div class="form-step"> <div class="step-icon">🔒</div> <input type="password" placeholder="Password" required> <input type="password" placeholder="Confirm Password" required> <div class="form-controls"> <button type="button" class="prev-btn">Previous</button> <button type="button" class="next-btn">Next</button> </div> </div> <div class="form-step"> <div class="step-icon">✔️</div> <h2>Thank you! 🥳</h2> <p>Your registration is complete.</p> <div class="form-controls"> <button type="button" class="prev-btn">Previous</button> <button type="submit">Submit</button> </div> </div> </form> </div> <script> const nextBtns = document.querySelectorAll('.next-btn'); const prevBtns = document.querySelectorAll('.prev-btn'); const formSteps = document.querySelectorAll('.form-step'); const progressSteps = document.querySelectorAll('.progress-bar .step'); let formStepNum = 0; nextBtns.forEach(btn => { btn.addEventListener('click', () => { formStepNum++; updateFormSteps(); updateProgressbar(); }); }); prevBtns.forEach(btn => { btn.addEventListener('click', () => { formStepNum--; updateFormSteps(); updateProgressbar(); }); }); function updateFormSteps() { formSteps.forEach(formStep => { formStep.classList.contains('active') && formStep.classList.remove('active'); }); formSteps[formStepNum].classList.add('active'); } function updateProgressbar() { progressSteps.forEach((progressStep, idx) => { if (idx <= formStepNum) { progressStep.classList.add('active'); } else { progressStep.classList.remove('active'); } }); } </script> </body> </html>