Glass Login 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>Glass Login</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=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet"> </head> <body> <!-- Particles --> <div class="particles" id="particles"></div> <!-- Glass Card --> <div class="glass-card"> <div class="card-content"> <div class="header"> <div class="logo"> <i class="fas fa-user-shield"></i> </div> <h1 class="title">Admin Portal</h1> <p class="subtitle">Secure access to dashboard</p> </div> <form id="loginForm"> <div class="form-group"> <div class="input-container"> <i class="fas fa-user input-icon"></i> <input type="email" id="email" placeholder="Email address" required> </div> </div> <div class="form-group"> <div class="input-container"> <i class="fas fa-lock input-icon"></i> <input type="password" id="password" placeholder="Password" required> <button type="button" class="password-toggle" id="togglePassword"> <i class="fas fa-eye"></i> </button> </div> </div> <label class="remember-container"> <input type="checkbox" id="remember" hidden> <span class="custom-checkbox"></span> <span>Remember me for 30 days</span> </label> <button type="submit" class="glass-btn" id="submitBtn"> <span id="btnText">Sign In</span> <div class="loader" id="loader"></div> </button> </form> <div class="footer"> <p> <a href="#">Forgot Password?</a> • <a href="#">Help Center</a> • <a href="#">Privacy Policy</a> </p> </div> </div> </div> </body> </html>
CSS
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Montserrat', sans-serif; min-height: 100vh; background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); display: flex; justify-content: center; align-items: center; padding: 20px; position: relative; overflow: hidden; } /* Floating particles */ .particles { position: absolute; width: 100%; height: 100%; z-index: 1; } .particle { position: absolute; background: rgba(255, 255, 255, 0.1); border-radius: 50%; animation: floatParticle 20s infinite linear; } @keyframes floatParticle { 0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { transform: translate(100px, -100vh) rotate(360deg) scale(0); opacity: 0; } } /* Glass card */ .glass-card { width: 100%; max-width: 380px; background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(20px); border-radius: 20px; padding: 40px; border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.1); position: relative; z-index: 10; overflow: hidden; animation: floatCard 6s ease-in-out infinite; } @keyframes floatCard { 0%, 100% { transform: translateY(0) rotateX(0); } 50% { transform: translateY(-10px) rotateX(1deg); } } .glass-card::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: linear-gradient( 45deg, transparent, rgba(255, 255, 255, 0.1), transparent ); transform: rotate(45deg); animation: shine 8s infinite; } @keyframes shine { 0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); } 100% { transform: translateX(100%) translateY(100%) rotate(45deg); } } .card-content { position: relative; z-index: 2; } /* Header */ .header { text-align: center; margin-bottom: 35px; } .logo { width: 70px; height: 70px; margin: 0 auto 20px; background: rgba(255, 255, 255, 0.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid rgba(255, 255, 255, 0.3); color: white; font-size: 28px; backdrop-filter: blur(5px); } .title { color: white; font-size: 28px; font-weight: 600; margin-bottom: 8px; } .subtitle { color: rgba(255, 255, 255, 0.8); font-size: 14px; font-weight: 400; } /* Form */ .form-group { margin-bottom: 25px; } .input-container { position: relative; } .input-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: rgba(255, 255, 255, 0.7); font-size: 18px; z-index: 2; transition: color 0.3s; } input { width: 100%; padding: 16px 16px 16px 50px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px; color: white; font-size: 16px; font-weight: 400; transition: all 0.3s; backdrop-filter: blur(5px); } input::placeholder { color: rgba(255, 255, 255, 0.5); } input:focus { outline: none; background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.4); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1); } input:focus + .input-icon { color: white; } .password-toggle { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); background: none; border: none; color: rgba(255, 255, 255, 0.7); cursor: pointer; font-size: 18px; transition: color 0.3s; } .password-toggle:hover { color: white; } /* Checkbox */ .remember-container { display: flex; align-items: center; gap: 10px; margin-bottom: 25px; color: rgba(255, 255, 255, 0.8); font-size: 14px; } .custom-checkbox { width: 20px; height: 20px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 5px; position: relative; cursor: pointer; transition: all 0.3s; } .custom-checkbox::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 12px; opacity: 0; transition: opacity 0.3s; } input[type="checkbox"]:checked + .custom-checkbox { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.5); } input[type="checkbox"]:checked + .custom-checkbox::after { opacity: 1; } /* Button */ .glass-btn { width: 100%; padding: 16px; background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 12px; color: white; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; backdrop-filter: blur(5px); position: relative; overflow: hidden; } .glass-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient( 90deg, transparent, rgba(255, 255, 255, 0.2), transparent ); transition: left 0.5s; } .glass-btn:hover::before { left: 100%; } .glass-btn:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-3px); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); } .glass-btn:active { transform: translateY(-1px); } /* Footer */ .footer { text-align: center; margin-top: 25px; color: rgba(255, 255, 255, 0.6); font-size: 13px; } .footer a { color: rgba(255, 255, 255, 0.8); text-decoration: none; margin: 0 8px; transition: color 0.3s; position: relative; } .footer a:hover { color: white; } .footer a::after { content: ''; position: absolute; width: 0; height: 1px; bottom: -2px; left: 0; background: white; transition: width 0.3s; } .footer a:hover::after { width: 100%; } /* Loader */ .loader { width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.3); border-top-color: white; border-radius: 50%; animation: spin 1s linear infinite; display: none; } @keyframes spin { to { transform: rotate(360deg); } } /* Responsive */ @media (max-width: 480px) { .glass-card { padding: 30px 25px; max-width: 90%; } .logo { width: 60px; height: 60px; font-size: 24px; } .title { font-size: 24px; } }
JavaScript
document.addEventListener('DOMContentLoaded', function() { // Create particles const particlesContainer = document.getElementById('particles'); for (let i = 0; i < 20; i++) { const particle = document.createElement('div'); particle.className = 'particle'; particle.style.left = Math.random() * 100 + '%'; particle.style.top = Math.random() * 100 + '%'; particle.style.width = particle.style.height = (Math.random() * 60 + 20) + 'px'; particle.style.animationDelay = Math.random() * 20 + 's'; particle.style.opacity = Math.random() * 0.2 + 0.05; particlesContainer.appendChild(particle); } // Password toggle const togglePassword = document.getElementById('togglePassword'); const passwordInput = document.getElementById('password'); 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 const loginForm = document.getElementById('loginForm'); const submitBtn = document.getElementById('submitBtn'); const btnText = document.getElementById('btnText'); const loader = document.getElementById('loader'); loginForm.addEventListener('submit', function(e) { e.preventDefault(); const email = document.getElementById('email').value; const password = document.getElementById('password').value; // Show loading btnText.textContent = ''; loader.style.display = 'block'; submitBtn.disabled = true; // Simulate login setTimeout(() => { if (email && password) { // Success loader.style.display = 'none'; btnText.textContent = 'Welcome!'; submitBtn.style.background = 'rgba(72, 187, 120, 0.3)'; submitBtn.style.borderColor = 'rgba(72, 187, 120, 0.5)'; setTimeout(() => { alert(`Access granted!\nWelcome back, ${email}`); resetForm(); }, 1000); } else { // Error loader.style.display = 'none'; btnText.textContent = 'Try again'; submitBtn.style.background = 'rgba(245, 101, 101, 0.3)'; submitBtn.style.borderColor = 'rgba(245, 101, 101, 0.5)'; setTimeout(() => { resetForm(); }, 1500); } }, 2000); }); function resetForm() { btnText.textContent = 'Sign In'; submitBtn.disabled = false; submitBtn.style.background = 'rgba(255, 255, 255, 0.15)'; submitBtn.style.borderColor = 'rgba(255, 255, 255, 0.3)'; } // Add input focus effects const inputs = document.querySelectorAll('input'); inputs.forEach(input => { const container = input.parentElement; input.addEventListener('focus', function() { container.style.transform = 'scale(1.02)'; }); input.addEventListener('blur', function() { container.style.transform = 'scale(1)'; }); }); });
Output Preview
Desktop
Mobile
Fullscreen