Nice article. On question, instead of using labels, couldn't we just move the placeholder itself out of the input when the input is focused? (Haven't tried it but just an idea)
I'm a front-end web developer who creates responsive websites using HTML, CSS and JavaScript from design mock-ups. I'm continuously learning to improve my skills. 👩🏻💻
I think the placeholder is pretty limited in terms of what you can style with CSS. Also the other main issues are that the placeholder text will go away once you fill in the text input, and they don't provide information for accessibility like form labels do.
You're right. My idea was to move the placeholder upward once the user starts typing, but when I tried to change its margin, it disappeared into the input border and changing the z-index didn't have any effect.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article. On question, instead of using labels, couldn't we just move the placeholder itself out of the input when the input is focused? (Haven't tried it but just an idea)
I think the placeholder is pretty limited in terms of what you can style with CSS. Also the other main issues are that the placeholder text will go away once you fill in the text input, and they don't provide information for accessibility like form labels do.
You're right. My idea was to move the placeholder upward once the user starts typing, but when I tried to change its margin, it disappeared into the input border and changing the
z-index
didn't have any effect.