How to move placeholder to top on focus AND while typing?

前端 未结 7 1220
野的像风
野的像风 2020-11-29 17:38

I want the placeholder to move to the top when the textbox is on focus and also while the user is typing.

I\'m not sure if this is just html/css or any javascript to

7条回答
  •  攒了一身酷
    2020-11-29 18:06

    That site isn't moving the placeholder, but placing a div (.floating-label) over the input, so when the input is focused the div just animates to be over the input. The key part here is using pointer-events: none; in the floating div, so when you click it the event goes through it to the input box behind it.

提交回复
热议问题