Sign In 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>Sign In</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=Inter:wght@300;400;500;600&family=Playfair+Display:wght@400;500&display=swap" rel="stylesheet"> </head> <body> <div class="bg-pattern"></div> <div class="login-container"> <div class="line-top"></div> <div class="brand"> <h1>Admin</h1> <p>Secure Access</p> </div> <form id="loginForm"> <div class="form-group"> <div class="input-field"> <input type="email" id="email" required> <label class="input-label">Email Address</label> <i class="fas fa-envelope input-icon"></i> </div> </div> <div class="form-group"> <div class="input-field"> <input type="password" id="password" required> <label class="input-label">Password</label> <i class="fas fa-lock input-icon"></i> <button type="button" class="password-toggle" id="togglePassword"> <i class="fas fa-eye"></i> </button> </div> </div> <button type="submit" class="submit-btn" id="submitBtn"> Sign In </button> <div class="status-message" id="statusMessage"></div> <div class="footer-links"> <a href="#" class="footer-link">Forgot password?</a> <a href="#" class="footer-link">Need an account?</a> <a href="#" class="footer-link">Help Center</a> </div> </form> <div class="line-bottom"></div> </div> </body> </html>
CSS
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Inter', sans-serif; min-height: 100vh; background: #fff; display: flex; justify-content: center; align-items: center; padding: 20px; position: relative; } /* Subtle background pattern */ .bg-pattern { position: absolute; width: 100%; height: 100%; opacity: 0.03; background-image: radial-gradient(#4F46E5 1px, transparent 1px), radial-gradient(#4F46E5 1px, transparent 1px); background-size: 40px 40px; background-position: 0 0, 20px 20px; z-index: -1; } .login-container { width: 100%; max-width: 380px; padding: 50px 40px; border: 1px solid #f1f1f1; border-radius: 2px; background: #fff; position: relative; animation: fadeUp 0.8s ease-out; } @keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } } /* Decorative lines */ .line-top { position: absolute; top: 0; left: 40px; right: 40px; height: 1px; background: linear-gradient(90deg, transparent, #4F46E5, transparent); } .line-bottom { position: absolute; bottom: 0; left: 40px; right: 40px; height: 1px; background: linear-gradient(90deg, transparent, #4F46E5, transparent); } .brand { text-align: center; margin-bottom: 40px; } .brand h1 { font-family: 'Playfair Display', serif; font-size: 32px; font-weight: 500; color: #1a1a1a; margin-bottom: 8px; letter-spacing: 1px; } .brand p { color: #666; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; } .form-group { margin-bottom: 24px; } .input-field { position: relative; } .input-field input { width: 100%; padding: 14px 0; border: none; border-bottom: 1px solid #e0e0e0; font-size: 16px; color: #333; background: transparent; transition: all 0.3s; } .input-field input:focus { outline: none; border-bottom-color: #4F46E5; padding-left: 30px; } .input-field input::placeholder { color: #999; transition: color 0.3s; } .input-field input:focus::placeholder { color: #4F46E5; opacity: 0.7; } .input-icon { position: absolute; left: 0; top: 50%; transform: translateY(-50%); color: #999; font-size: 16px; opacity: 0; transition: all 0.3s; } .input-field input:focus ~ .input-icon { opacity: 1; color: #4F46E5; } .input-label { position: absolute; left: 0; top: 50%; transform: translateY(-50%); color: #999; font-size: 16px; pointer-events: none; transition: all 0.3s; } .input-field input:focus ~ .input-label, .input-field input:valid ~ .input-label { top: 0; font-size: 12px; color: #4F46E5; } .password-toggle { position: absolute; right: 0; top: 50%; transform: translateY(-50%); background: none; border: none; color: #999; cursor: pointer; font-size: 16px; transition: color 0.3s; } .password-toggle:hover { color: #4F46E5; } .submit-btn { width: 100%; padding: 14px; background: #4F46E5; color: white; border: 1px solid #4F46E5; font-size: 16px; font-weight: 500; cursor: pointer; transition: all 0.3s; margin-top: 10px; position: relative; overflow: hidden; } .submit-btn:hover { background: transparent; color: #4F46E5; } .submit-btn::after { content: ''; position: absolute; top: 50%; left: 50%; width: 5px; height: 5px; background: rgba(255, 255, 255, 0.5); opacity: 0; border-radius: 100%; transform: scale(1, 1) translate(-50%); transform-origin: 50% 50%; } .submit-btn:focus:not(:active)::after { animation: ripple 1s ease-out; } @keyframes ripple { 0% { transform: scale(0, 0); opacity: 0.5; } 100% { transform: scale(40, 40); opacity: 0; } } .footer-links { display: flex; justify-content: space-between; margin-top: 25px; font-size: 13px; } .footer-link { color: #666; text-decoration: none; transition: color 0.3s; position: relative; } .footer-link:hover { color: #4F46E5; } .footer-link::after { content: ''; position: absolute; width: 0; height: 1px; bottom: -2px; left: 0; background: #4F46E5; transition: width 0.3s; } .footer-link:hover::after { width: 100%; } /* Status message */ .status-message { text-align: center; margin-top: 20px; font-size: 14px; height: 20px; opacity: 0; transition: opacity 0.3s; } .status-message.show { opacity: 1; } /* Responsive */ @media (max-width: 480px) { .login-container { padding: 40px 30px; border: none; } .line-top, .line-bottom { left: 30px; right: 30px; } .brand h1 { font-size: 28px; } .footer-links { flex-direction: column; gap: 10px; align-items: center; } }
JavaScript
document.addEventListener('DOMContentLoaded', function() { const togglePassword = document.getElementById('togglePassword'); const passwordInput = document.getElementById('password'); const submitBtn = document.getElementById('submitBtn'); const statusMessage = document.getElementById('statusMessage'); // Password toggle togglePassword.addEventListener('click', function() { const type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password'; passwordInput.setAttribute('type', type); const icon = this.querySelector('i'); icon.classList.toggle('fa-eye'); icon.classList.toggle('fa-eye-slash'); }); // Form submission document.getElementById('loginForm').addEventListener('submit', function(e) { e.preventDefault(); const email = document.getElementById('email').value; const password = document.getElementById('password').value; // Show loading submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i>'; submitBtn.disabled = true; statusMessage.textContent = 'Authenticating...'; statusMessage.className = 'status-message show'; statusMessage.style.color = '#666'; // Simulate login setTimeout(() => { if (email && password) { // Success submitBtn.innerHTML = '<i class="fas fa-check"></i>'; submitBtn.style.background = '#10B981'; submitBtn.style.borderColor = '#10B981'; statusMessage.textContent = 'Access granted. Redirecting...'; statusMessage.style.color = '#10B981'; setTimeout(() => { alert(`Welcome!\nYou have successfully signed in.`); resetForm(); }, 1200); } else { // Error submitBtn.innerHTML = '<i class="fas fa-times"></i>'; submitBtn.style.background = '#EF4444'; submitBtn.style.borderColor = '#EF4444'; statusMessage.textContent = 'Please check your credentials'; statusMessage.style.color = '#EF4444'; setTimeout(() => { resetForm(); }, 2000); } }, 1800); }); function resetForm() { submitBtn.innerHTML = 'Sign In'; submitBtn.disabled = false; submitBtn.style.background = '#4F46E5'; submitBtn.style.borderColor = '#4F46E5'; statusMessage.className = 'status-message'; statusMessage.textContent = ''; } // Input validation const inputs = document.querySelectorAll('input'); inputs.forEach(input => { input.addEventListener('input', function() { if (this.value) { this.parentElement.classList.add('has-value'); } else { this.parentElement.classList.remove('has-value'); } }); }); });
Output Preview
Desktop
Mobile
Fullscreen