This login UI uses floating labels and motion feedback to maintain clarity in compact authentication flows.
HTML
<form class="login-float">
<div class="login-float__field">
<input type="email" required />
<label>Email</label>
</div>
<button type="submit">Sign In</button>
</form>CSS
.login-float {
width: 200px;
padding: 1rem;
border-radius: 16px;
background: #ffffff;
box-shadow: 0 16px 32px rgba(0,0,0,0.12);
display: grid;
gap: 0.75rem;
}
.login-float__field {
position: relative;
}
.login-float__field input {
width: 100%;
padding: 0.6rem;
border-radius: 8px;
border: 1px solid #e5e7eb;
background: transparent;
color: #111827;
font-size: 12px;
}
.login-float__field label {
position: absolute;
left: 0.6rem;
top: 50%;
font-size: 11px;
color: #6b7280;
transform: translateY(-50%);
pointer-events: none;
transition: all 150ms ease;
}
.login-float__field input:focus + label,
.login-float__field input:not(:placeholder-shown) + label {
top: -6px;
background: #ffffff;
padding: 0 0.25rem;
font-size: 10px;
color: #6366f1;
}
.login-float button {
padding: 0.5rem;
border-radius: 10px;
border: none;
background: #6366f1;
color: #ffffff;
font-size: 12px;
cursor: pointer;
}
@media (prefers-color-scheme: dark) {
.login-float {
background: #111827;
color: #e5e7eb;
}
.login-float__field input {
border-color: #374151;
color: #e5e7eb;
}
.login-float__field label {
color: #9ca3af;
}
}Notes
- Floating labels reduce placeholder reliance
- Motion improves field clarity
- Suitable for compact auth widgets
Preview styles shown. Production customization recommended.
Browse More UI Components
Explore hundreds of reusable HTML & CSS UI components built for modern web projects.
Discover buttons, cards, loaders, animations, layouts, and more all with live previews and clean, copy-paste code.
