W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: [css3-ui] Styling the HTML5 input element placeholder

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 8 Apr 2011 13:27:51 -0700
Message-ID: <BANLkTimv0bcbrOvfp_WeVyj6S0yjdJRb4Q@mail.gmail.com>
To: Sylvain Galineau <sylvaing@microsoft.com>
Cc: "www-style@w3.org" <www-style@w3.org>, "Sharon Newman (COHEN)" <Sharon.Newman@microsoft.com>
On Fri, Apr 8, 2011 at 1:21 PM, Sylvain Galineau <sylvaing@microsoft.com> wrote:
> [Tab Atkins]:
>> The problem with a pseudoclass is that the best default styling is to use
>> the normal input text color, but more transparent.  That ensures that the
>> placeholder text is always visible (assuming the original text is, which
>> we have to assume), but is clearly "less real" than normal text.  However,
>> there's no way to control text opacity separately from the color.  Using a
>> pseudo-element lets you just set 'opacity' on it and inherit the color by
>> default.
> Sorry, I don't understand this explanation. Why wouldn't  the empty non-focused
> element not match both the default style rules (in the UA or author stylesheet)
> and the opacity set in your placeholder pseudo-class rule ? I can apply opacity
> to the current color of elements on :hover or :active, right ?

You don't want the *input* to suddenly gain opacity.  Now, if you
applied it via "input:placeholder::text" or something, that would be

Received on Friday, 8 April 2011 20:28:39 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:45 UTC