Toggle navigation
☰
HTML
CSS
Scripting
Database
<!doctype html> <title>Example</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; font-family: sans-serif; background-color: #f0f0f0; } .input-container { position: relative; margin-top: 20px; width: 250px; } .floating-input { width: 100%; padding: 10px 0; font-size: 1rem; color: #333; border: none; border-bottom: 2px solid #aaa; outline: none; background-color: transparent; transition: border-color 0.2s; } .floating-label { position: absolute; top: 10px; left: 0; font-size: 1rem; color: #aaa; pointer-events: none; transition: all 0.2s ease; } .floating-input:focus, .floating-input:not(:placeholder-shown) { border-bottom-color: #007bff; } .floating-input:focus ~ .floating-label, .floating-input:not(:placeholder-shown) ~ .floating-label { top: -20px; font-size: 0.8rem; color: #007bff; } @media (prefers-reduced-motion: reduce) { .floating-input, .floating-label { transition: none; } } </style> <div class="input-container"> <!-- Note: placeholder=" " is required for :placeholder-shown to work correctly --> <input type="text" id="name" class="floating-input" placeholder=" " required> <label for="name" class="floating-label">Full Name</label> </div>