W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] Customize HTML5 forms placeholder style

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Sun, 21 Feb 2010 16:46:39 -0500
Message-ID: <7c2a12e21002211346l59759f8bwfd44e8dbd71a24b4@mail.gmail.com>
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; }
Received on Sunday, 21 February 2010 13:46:39 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:21 UTC