[whatwg] Customize HTML5 forms placeholder style

Aryeh Gregor Simetrical+w3c at gmail.com
Sun Feb 21 13:46:39 PST 2010


On Thu, Feb 18, 2010 at 5:40 PM, L. David Baron <dbaron at dbaron.org> wrote:
> I think the question is whether, given author style for the input's
> text but no specific style for the placeholder, you're better off
> falling back to the default style for the placeholder or to the
> author style for the input.  It's not obvious to me which is the
> right answer.

IMO, the principle of least surprise dictates a third answer: make the
placeholder color a blend of the foreground and background colors.
Maybe making it have the same color as the foreground, but with some
alpha.  Then with black-on-white it's gray, but with pink-on-orange it
takes on a suitably hideous tincture.

One implementation idea would be a pseudo-element, with something like
this in the UA stylesheet:

::placeholder { opacity: 0.6; }



More information about the whatwg mailing list