Elegant 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>Elegant Form - Multipurpose HTML Form</title> <style> body, html { margin: 0; padding: 0; font-family: 'Poppins', sans-serif; background: linear-gradient(120deg, #fdfbfb, #ebedee); display: flex; justify-content: center; align-items: center; height: 100vh; color: #2c3e50; background-attachment: fixed; } .container { background: #ffffff; border-radius: 20px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); overflow: hidden; width: 100%; max-width: 800px; position: relative; } .tabs { display: flex; justify-content: space-between; background: #3498db; color: #ffffff; } .tabs div { padding: 20px; cursor: pointer; transition: background 0.3s ease; } .tabs div:hover, .tabs .active { background: #2980b9; } .form-section { display: none; padding: 30px; } .form-section.active { display: block; animation: fadeIn 0.5s ease; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 10px; } .form-group input, .form-group textarea { width: 93%; padding: 15px; border: 1px solid #ddd; border-radius: 10px; transition: border 0.3s ease; outline: none; } .form-group input:focus, .form-group textarea:focus { border: 1px solid #3498db; } .form-group button { background: #3498db; color: #fff; border: none; padding: 15px 25px; border-radius: 10px; cursor: pointer; transition: background 0.3s ease; } .form-group button:hover { background: #2980b9; } .auth-icons { display: flex; justify-content: space-between; margin-bottom: 30px; } .auth-icons i { font-size: 2em; cursor: pointer; transition: color 0.3s ease; } .auth-icons i:hover { color: #3498db; } .step { display: none; } .step.active { display: block; } .steps { display: flex; justify-content: space-between; margin-bottom: 30px; } .steps div { flex: 1; text-align: center; padding: 15px; background: #ddd; border-radius: 10px; margin: 0 10px; cursor: pointer; transition: background 0.3s ease; } .steps .active { background: #3498db; color: #fff; } .chat-box { border: 1px solid #ddd; border-radius: 10px; padding: 20px; background: #f9f9f9; height: 250px; overflow-y: auto; margin-bottom: 20px; } .chat-box .message { margin-bottom: 15px; padding: 15px; background: #ecf0f1; border-radius: 10px; } .chat-box .message.user { background: #3498db; color: #fff; } .chat-input { display: flex; } .chat-input input { flex: 1; padding: 15px; border: 1px solid #ddd; border-radius: 10px 0 0 10px; } .chat-input button { padding: 15px; background: #3498db; color: #fff; border: none; border-radius: 0 10px 10px 0; cursor: pointer; transition: background 0.3s ease; } .chat-input button:hover { background: #2980b9; } </style> </head> <body> <div class="container"> <div class="tabs"> <div class="tab" onclick="openTab('auth')">Authentication</div> <div class="tab" onclick="openTab('chat')">Chat-box</div> <div class="tab" onclick="openTab('multi')">Multi-step Form</div> <div class="tab" onclick="openTab('contact')">Contact</div> </div> <div id="auth" class="form-section active"> <h2>Authentication</h2> <div class="auth-icons"> <i class="fa fa-facebook" aria-hidden="true"></i> <i class="fa fa-google" aria-hidden="true"></i> <i class="fa fa-twitter" aria-hidden="true"></i> </div> <div class="form-group"> <label for="username">Username</label> <input type="text" id="username" placeholder="Enter your username"> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" id="password" placeholder="Enter your password"> </div> <div class="form-group"> <button type="button" onclick="alert('Logged in!')">Login</button> </div> </div> <div id="chat" class="form-section"> <h2>Chat-box</h2> <div class="chat-box" id="chatBox"> <!-- Messages will be appended here --> </div> <div class="chat-input"> <input type="text" id="chatInput" placeholder="Type a message"> <button onclick="sendMessage()">Send</button> </div> </div> <div id="multi" class="form-section"> <h2>Multi-step Form</h2> <div class="steps"> <div class="step-nav active" onclick="showStep(0)">Step 1</div> <div class="step-nav" onclick="showStep(1)">Step 2</div> <div class="step-nav" onclick="showStep(2)">Step 3</div> </div> <div class="step active"> <div class="form-group"> <label for="firstName">First Name</label> <input type="text" id="firstName" placeholder="Enter your first name"> </div> <div class="form-group"> <button type="button" onclick="nextStep()">Next</button> </div> </div> <div class="step"> <div class="form-group"> <label for="lastName">Last Name</label> <input type="text" id="lastName" placeholder="Enter your last name"> </div> <div class="form-group"> <button type="button" onclick="nextStep()">Next</button> </div> </div> <div class="step"> <div class="form-group"> <label for="email">Email</label> <input type="email" id="email" placeholder="Enter your email"> </div> <div class="form-group"> <button type="button" onclick="alert('Form submitted!')">Submit</button> </div> </div> </div> <div id="contact" class="form-section"> <h2>Contact</h2> <div class="form-group"> <label for="name">Name</label> <input type="text" id="name" placeholder="Enter your name"> </div> <div class="form-group"> <label for="emailContact">Email</label> <input type="email" id="emailContact" placeholder="Enter your email"> </div> <div class="form-group"> <label for="message">Message</label> <textarea id="message" rows="4" placeholder="Enter your message"></textarea> </div> <div class="form-group"> <button type="button" onclick="alert('Message sent!')">Send</button> </div> </div> </div> <script> function openTab(tabId) { document.querySelectorAll('.form-section').forEach(section => { section.classList.remove('active'); }); document.querySelector(`#${tabId}`).classList.add('active'); document.querySelectorAll('.tabs .tab').forEach(tab => { tab.classList.remove('active'); }); document.querySelector(`.tabs .tab[onclick="openTab('${tabId}')"]`).classList.add('active'); } function sendMessage() { const chatBox = document.getElementById('chatBox'); const chatInput = document.getElementById('chatInput'); if (chatInput.value.trim()) { const message = document.createElement('div'); message.className = 'message user'; message.innerText = chatInput.value; chatBox.appendChild(message); chatInput.value = ''; chatBox.scrollTop = chatBox.scrollHeight; } } let currentStep = 0; function showStep(stepIndex) { const steps = document.querySelectorAll('.step'); steps[currentStep].classList.remove('active'); steps[stepIndex].classList.add('active'); currentStep = stepIndex; document.querySelectorAll('.step-nav').forEach((nav, index) => { if (index === stepIndex) { nav.classList.add('active'); } else { nav.classList.remove('active'); } }); } function nextStep() { const steps = document.querySelectorAll('.step'); if (currentStep < steps.length - 1) { showStep(currentStep + 1); } } </script> <!-- Icons (FontAwesome) --> <script src="https://kit.fontawesome.com/a076d05399.js"></script> </body> </html>