Basically i want to give some transition to input by padding bottom placeholders on focus, but it’s not working
.formInput{
transition: padding-bottom 0.3s;
}
.formInput:focus::placeholder {
padding-bottom: 100px !important;
}
I can give it a color and it will change on focus, but padding-bottom
is not working, neither margin
2
Answers
When working with placeholder text in input elements, CSS properties like padding-bottom and margin don’t apply directly to the ::placeholder pseudo-element. This is because the
::placeholder
pseudo-element is not designed to handle layout properties in the same way as other elements.However, if you still want to move the
::placeholder
pseudo-element:Being a pseudo element, you can just move the placeholder around.
Your best bet is to simulate a placeholder.
I did this once, and it just works !
For the following HTML :
Of course, adapt it to your use case, and tell me if it doesn’t work, because it does on my side, so I probably forgot to send a bit !
Kind regards