[whatwg] Customize HTML5 forms placeholder style

Tab Atkins Jr. jackalmage at gmail.com
Mon Feb 22 06:26:37 PST 2010

On Mon, Feb 22, 2010 at 5:08 AM, Dean Edwards <dean at edwards.name> wrote:
> Yes, I'm suggesting redefining how :empty works. For elements that
> cannot have children it could mean having no content. e.g. An <input>
> with no value or an <img> with no src.
> It gets around the need for a new :placeholder pseudo-class:
> input[placeholder]:empty {
>  color: red;
> }

To get it to act like implementations do, you have to use
"input[placeholder]:empty:not(:focus)".  That's pretty complex.  ^_^

> There is a small chance that it could break some pages I guess. If
> people are using *:empty than it may start matching some <input>
> elements.
> I always wanted a pseudo-class that could match <input> with no value.
> Extending :empty is probably a bad idea but something like :no-value
> would be useful.

I certainly see the value in such a thing.


More information about the whatwg mailing list