A
A
Alexander2015-04-28 13:41:15
css
Alexander, 2015-04-28 13:41:15

How to make a "pop-up" placeholder?

Good afternoon.
It is necessary to lay out the input so that when the focus is on, the placeholder smoothly floats up and becomes a "label" (and also decreases in size). Accordingly, with blur, if the field was filled, then the placeholder remains at the top; if the field remains empty, then the placeholder also smoothly falls to its rightful place.
I tried to do it on crutches using positioning, but I would still like to use some more intelligent and universal way, if it exists. Can't do without your help
Thank you
0cff21cb36164f6b86e7a897820435cf.png

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Sergey delphinpro, 2015-04-28
@Labriko

Realization of placeholders inside input'a?
See my answer there. Just on your topic.

1
123 123, 2015-04-28
@roman01la

Use only label, that's the standard and it automatically makes the form field more accessible.
Example: jsbin.com/vaqoxikika/1/edit?html,css,output

R
Roman, 2015-04-28
@paradoxo

instead of a placeholder, use a span
, so you can do whatever you want with it.
And then, either with CSS selectors or scripts, you set the behavior of the span with focus and blur

Z
zooks, 2015-04-28
@zooks

Execution option: make not a placeholder, but a label lying behind a translucent field.
When focusing on the field, the animation you need occurs and vice versa.

E
emiliya sokolova, 2015-04-28
@emilium

Here is an example codepen.io/emilium/pen/qdEMvE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question