User Registration Form Template
Preview
Edit
Download
Run
Download Options
HTML File
Download as .html file
CSS File
Download as .css file
JavaScript File
Download as .js file
Combined HTML
All code in one HTML file
Project ZIP
All files in a ZIP archive
Cancel
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Create Account</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> </head> <body> <div class="register-card"> <!-- Header --> <div class="card-header"> <div class="logo"> <div class="logo-icon"> <i class="fas fa-user-plus"></i> </div> <div class="logo-text"> <h1>Create Account</h1> <p>Join our community today</p> </div> </div> </div> <!-- Registration Form --> <div class="card-body"> <form id="registerForm"> <div class="form-row"> <div class="form-group"> <label>First Name</label> <div class="input-wrapper"> <i class="fas fa-user input-icon"></i> <input type="text" id="firstName" placeholder="John" required> </div> </div> <div class="form-group"> <label>Last Name</label> <div class="input-wrapper"> <i class="fas fa-user input-icon"></i> <input type="text" id="lastName" placeholder="Doe" required> </div> </div> </div> <div class="form-group"> <label>Email Address</label> <div class="input-wrapper"> <i class="fas fa-envelope input-icon"></i> <input type="email" id="email" placeholder="john@example.com" required> </div> </div> <div class="form-group"> <label>Password</label> <div class="input-wrapper"> <i class="fas fa-lock input-icon"></i> <input type="password" id="password" placeholder="Create a password" required> <button type="button" class="password-toggle"> <i class="fas fa-eye"></i> </button> </div> </div> <div class="form-group"> <label>Confirm Password</label> <div class="input-wrapper"> <i class="fas fa-lock input-icon"></i> <input type="password" id="confirmPassword" placeholder="Confirm your password" required> <button type="button" class="password-toggle"> <i class="fas fa-eye"></i> </button> </div> </div> <div class="terms"> <input type="checkbox" id="agreeTerms" required> <label for="agreeTerms"> I agree to the <a href="#">Terms of Service</a> and <a href="#">Privacy Policy</a> </label> </div> <button type="submit" class="submit-btn" id="submitBtn"> <span id="btnText">Create Account</span> <div class="loader" id="loader"></div> </button> <div class="login-link"> Already have an account? <a href="#">Sign in</a> </div> </form> <!-- Success Message --> <div class="success-message" id="successMessage"> <div class="success-icon"> <i class="fas fa-check"></i> </div> <h2>Welcome!</h2> <p>Your account has been created successfully.</p> <button class="submit-btn" onclick="window.location.href='#'" style="margin-top: 20px;"> <i class="fas fa-rocket"></i> Get Started </button> </div> </div> </div> </body> </html>
CSS
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Poppins', sans-serif; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; justify-content: center; align-items: center; padding: 20px; } .register-card { width: 100%; max-width: 400px; background: white; border-radius: 16px; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1); overflow: hidden; animation: fadeIn 0.6s ease-out; } @keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } } .card-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 40px 30px 30px; text-align: center; color: white; } .logo { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 20px; } .logo-icon { width: 50px; height: 50px; background: rgba(255, 255, 255, 0.2); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; backdrop-filter: blur(10px); } .logo-text h1 { font-size: 24px; font-weight: 600; margin-bottom: 5px; } .logo-text p { font-size: 14px; opacity: 0.9; } .card-body { padding: 30px; } .form-group { margin-bottom: 20px; } label { display: block; margin-bottom: 8px; color: #333; font-size: 14px; font-weight: 500; } .input-wrapper { position: relative; } .input-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #666; font-size: 18px; } input { width: 100%; padding: 15px 15px 15px 50px; border: 2px solid #e1e5e9; border-radius: 10px; font-size: 16px; color: #333; transition: all 0.3s; background: #f8fafc; } input:focus { outline: none; border-color: #667eea; background: white; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); } input:focus + .input-icon { color: #667eea; } .password-toggle { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #666; cursor: pointer; font-size: 18px; transition: color 0.3s; } .password-toggle:hover { color: #667eea; } .form-row { display: flex; gap: 15px; margin-bottom: 20px; } .form-row .form-group { flex: 1; margin-bottom: 0; } .terms { display: flex; align-items: flex-start; gap: 10px; margin: 25px 0; color: #555; font-size: 14px; } .terms input { width: 18px; height: 18px; margin-top: 3px; accent-color: #667eea; } .terms a { color: #667eea; text-decoration: none; font-weight: 500; } .terms a:hover { text-decoration: underline; } .submit-btn { width: 100%; padding: 16px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3); } .submit-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4); } .submit-btn:active { transform: translateY(0); } .login-link { text-align: center; margin-top: 20px; color: #666; font-size: 14px; } .login-link a { color: #667eea; text-decoration: none; font-weight: 500; } .login-link a:hover { text-decoration: underline; } .loader { width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.3); border-radius: 50%; border-top-color: white; animation: spin 1s linear infinite; display: none; } @keyframes spin { to { transform: rotate(360deg); } } .success-message { text-align: center; padding: 30px; display: none; animation: fadeIn 0.5s ease-out; } .success-icon { width: 60px; height: 60px; background: #10b981; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 28px; margin: 0 auto 20px; animation: scaleIn 0.5s ease-out; } @keyframes scaleIn { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } } .success-message h2 { color: #333; margin-bottom: 10px; } .success-message p { color: #666; margin-bottom: 20px; } /* Responsive */ @media (max-width: 480px) { .register-card { max-width: 100%; } .card-header { padding: 30px 25px 25px; } .card-body { padding: 25px 20px; } .form-row { flex-direction: column; gap: 20px; } .logo-icon { width: 45px; height: 45px; font-size: 22px; } .logo-text h1 { font-size: 22px; } }
JavaScript
document.addEventListener('DOMContentLoaded', function() { const registerForm = document.getElementById('registerForm'); const submitBtn = document.getElementById('submitBtn'); const btnText = document.getElementById('btnText'); const loader = document.getElementById('loader'); const successMessage = document.getElementById('successMessage'); // Password toggle document.querySelectorAll('.password-toggle').forEach(toggle => { toggle.addEventListener('click', function() { const input = this.parentElement.querySelector('input'); const type = input.getAttribute('type') === 'password' ? 'text' : 'password'; input.setAttribute('type', type); const icon = this.querySelector('i'); icon.classList.toggle('fa-eye'); icon.classList.toggle('fa-eye-slash'); }); }); // Form submission registerForm.addEventListener('submit', function(e) { e.preventDefault(); // Get values const firstName = document.getElementById('firstName').value.trim(); const lastName = document.getElementById('lastName').value.trim(); const email = document.getElementById('email').value.trim(); const password = document.getElementById('password').value; const confirmPassword = document.getElementById('confirmPassword').value; const agreeTerms = document.getElementById('agreeTerms').checked; // Simple validation let isValid = true; // Clear previous error states document.querySelectorAll('input').forEach(input => { input.style.borderColor = '#e1e5e9'; }); // Validate if (!firstName) { document.getElementById('firstName').style.borderColor = '#ef4444'; isValid = false; } if (!lastName) { document.getElementById('lastName').style.borderColor = '#ef4444'; isValid = false; } if (!email || !email.includes('@')) { document.getElementById('email').style.borderColor = '#ef4444'; isValid = false; } if (!password || password.length < 6) { document.getElementById('password').style.borderColor = '#ef4444'; isValid = false; } if (password !== confirmPassword) { document.getElementById('confirmPassword').style.borderColor = '#ef4444'; isValid = false; } if (!agreeTerms) { alert('Please agree to the terms and conditions'); isValid = false; } if (!isValid) { return; } // Show loading state btnText.style.display = 'none'; loader.style.display = 'block'; submitBtn.disabled = true; // Simulate API call (2 seconds delay) setTimeout(() => { // Hide form, show success registerForm.style.display = 'none'; successMessage.style.display = 'block'; // Reset button (optional) btnText.style.display = 'inline'; loader.style.display = 'none'; submitBtn.disabled = false; // In a real app, you would submit the data to your server here console.log('Registration data:', { firstName, lastName, email, // Note: Never log passwords in production passwordLength: password.length }); }, 2000); }); // Input focus effects const inputs = document.querySelectorAll('input'); inputs.forEach(input => { input.addEventListener('focus', function() { this.style.borderColor = '#667eea'; }); input.addEventListener('blur', function() { if (!this.value) { this.style.borderColor = '#e1e5e9'; } }); }); });
Output Preview
Desktop
Mobile
Fullscreen