[whatwg] Customize HTML5 forms placeholder style

Maciej Stachowiak mjs at apple.com
Thu Feb 18 21:49:19 PST 2010


On Feb 18, 2010, at 2:54 PM, L. David Baron wrote:

> On Thursday 2010-02-18 16:45 -0600, Tab Atkins Jr. wrote:
>> Anne suggested in IRC using the pseudoclass approach, and pairing it
>> with the ::value pseudoelem from the Basic UI Module.  You could get
>
> But the key question (from the Webkit bug) is really whether the UA
> styles apply to the input itself or a pseudo-element inside of it.
>
> If the UA style is
>  input:has-placeholder { color: ... }
> then, as far as I can tell, there's no point to styling the ::value.
>
> If the UA style is
>  input:has-placeholder::value { color: ... }
> then you get the same cascading result as with an input::placeholder
> pseudo-element (styles that don't select the pseudo-element don't
> change the UA default), but with the addition that authors can style
> the input in other ways.

If we did that, then one of the two differences between pseudo-class  
and pseudo-element approaches would be eliminated - in either case  
setting the input color via inline style would not also change the  
placeholder text color to the same color.

The remaining difference would be whether you could style aspects of  
the input element other than the text in the mode where it is showing  
placeholder text. What are the use cases for styling other aspects of  
the input element?

Regards,
Maciej




More information about the whatwg mailing list