-
CSS Login Input Focus effect animation
HTML
CSS
JavaScript
Login
Username
Password
Login
* { box-sizing: border-box; margin: 0; padding: 0; } body { min-height: 100vh; display: flex; justify-content: center; align-items: center; background: #0d1117; font-family: Arial, sans-serif; } .login-box { width: 360px; padding: 40px; border-radius: 20px; background: #161b22; box-shadow: 15px 15px 30px #080a0d, -10px -10px 25px #222a33; } .login-box h2 { text-align: center; color: #fff; margin-bottom: 30px; } /* Input group */ .input-group { position: relative; margin: 25px 0; } /* Input */ .input-group input { width: 100%; padding: 15px 15px; border: none; outline: none; border-radius: 10px; background: #161b22; color: #fff; font-size: 16px; box-shadow: inset 5px 5px 10px #080a0d, inset -5px -5px 10px #222a33; transition: 0.4s ease; } /* Placeholder */ .input-group label { position: absolute; left: 15px; top: 15px; color: #777; pointer-events: none; transition: 0.3s ease; } /* Focus effect */ .input-group input:focus { box-shadow: inset 3px 3px 7px #080a0d, inset -3px -3px 7px #222a33, 0 0 12px rgba(0, 200, 255, 0.5); transform: translateY(-2px); } /* Floating label */ .input-group input:focus + label, .input-group input:not(:placeholder-shown) + label { top: -10px; left: 12px; padding: 0 7px; background: #161b22; color: #00d9ff; font-size: 13px; } /* Login button */ button { width: 100%; padding: 14px; border: none; border-radius: 10px; background: #00d9ff; color: #071014; font-size: 16px; font-weight: bold; cursor: pointer; transition: 0.3s ease; } button:hover { transform: translateY(-3px); box-shadow: 0 0 20px rgba(0, 217, 255, 0.7); } button:active { transform: scale(0.97); }
Live Preview