mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-10-24 11:16:27 +02:00
38 lines
689 B
SCSS
38 lines
689 B
SCSS
.floating-label {
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 0.25rem;
|
|
position: relative;
|
|
|
|
/* Demo */
|
|
padding: 0px 1px;
|
|
height: 2.5rem;
|
|
}
|
|
|
|
.floating-label__input {
|
|
border: none;
|
|
padding: 0.5rem;
|
|
height: 100%;
|
|
}
|
|
|
|
/*
|
|
Show the label at desired position when the
|
|
placeholder of input isn't shown
|
|
*/
|
|
.floating-label__input:not(:placeholder-shown) + .floating-label__label {
|
|
background: #fff;
|
|
transform: translate(0, -200%);
|
|
opacity: 1;
|
|
}
|
|
|
|
.floating-label__label {
|
|
/* Position the label */
|
|
left: 1rem;
|
|
position: absolute;
|
|
top: 100%;
|
|
|
|
/* Hide it by default */
|
|
opacity: 0;
|
|
transition: all 200ms;
|
|
|
|
padding: 0 0.5rem;
|
|
} |