Day #8 of Learning in Public
Pratik Kumar Jaiswal
319k+ Impression FREELANCE WEB DEVELOPER | REACT js | Firebase | MySQL | Node js | Shopify | WordPress | Webflow
Today I learned how to add form and do custom animations as per your choice.
Used focus and placeholders in #sass.
Below is the reference code attached.
.form {
&__group:not(:last-child) {
margin-bottom: 2rem;
}
&__input {
font-size: 1.5rem;
font-family: inherit;
color: inherit;
padding: 1.5rem 2rem;
border-radius: 2px;
background-color: rgba($color: #f8f7f7, $alpha: 0.5);
border: none;
border-bottom: 2px solid transparent;
width: 85%;
display: block;
&:focus {
outline: none;
box-shadow: 0 1rem rgba($color: gray, $alpha: 0.1);
border-bottom: 2px solid green;
background-color: rgba($color: gray, $alpha: 0.1);
}
&:focus:invalid {
border-bottom: 2px solid orange;
}
&::-webkit-input-placeholder {
color: gray;
}
}
&__label {
font-size: 1.2rem;
font-weight: 700;
margin-left: 2rem;
margin-top: 0.7rem;
display: block;
transition: all 0.3s;
}
&__input:placeholder-shown + &__label {
opacity: 0;
visibility: hidden;
transform: translateY(-4rem);
}
}