Re: Styling HTML placeholder attribute

On Wed, Jan 23, 2013 at 2:24 PM, Lea Verou <lea@w3.org> wrote:

2) Is there any other use case for a pseudoelement apart from opacity? I
> can't see any, but my imagination might be limited. :)


Before most browsers supported placeholders, it was pretty common to see
jQuery plugins polyfill this behavior. A common effect was to have the
placeholder start at a gray color, fade out when you focused on the
element, and then disappear completely as soon as you typed a single
character.

This would be impossible to achieve in pure CSS unless the placeholder were
a pseudo-element.

Here's a demo plugin that's pretty similar to what I used to see a lot:
http://jsfiddle.net/6HQWv/

Received on Wednesday, 23 January 2013 22:48:10 UTC