CSS
.if-float {
position: relative;
display: block;
width: 100%;
max-width: 280px;
}
.if-float input {
width: 100%;
box-sizing: border-box;
padding: 18px 14px 8px;
background: #1a1a22;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 10px;
color: #f0eeff;
font-size: 14px;
outline: none;
transition:
border-color 0.2s,
background 0.2s;
}
.if-float input:focus {
border-color: #7c6cff;
background: #1f1f2a;
}
.if-float-label {
position: absolute;
left: 14px;
top: 14px;
font-size: 13px;
color: #b8b6d4;
pointer-events: none;
transition:
transform 0.2s,
font-size 0.2s,
color 0.2s;
}
.if-float input:focus + .if-float-label,
.if-float input:not(:placeholder-shown) + .if-float-label {
transform: translateY(-9px);
font-size: 10px;
color: #a78bfa;
letter-spacing: 0.06em;
text-transform: uppercase;
}