W3C home > Mailing lists > Public > www-style@w3.org > January 2013

Re: Styling HTML placeholder attribute

From: Øyvind Stenhaug <oyvinds@opera.com>
Date: Thu, 24 Jan 2013 11:03:51 +0100
To: "Brad Kemper" <brad.kemper@gmail.com>
Cc: "Lea Verou" <lea@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>, "Sylvain Galineau" <sylvaing@microsoft.com>, "Mounir Lamouri" <mounir@lamouri.fr>, "www-style list" <www-style@w3.org>
Message-ID: <op.wret8pd7bunlto@oyvinds-desktop>
On Thu, 24 Jan 2013 06:40:37 +0100, Brad Kemper <brad.kemper@gmail.com>  

> On Jan 23, 2013, at 5:12 PM, Lea Verou <lea@w3.org> wrote:
>> The main issue with that is that if authors don't style it but they do  
>> style input, the UA stylesheet can't override that with  
>> input:not(:completed), similarly to how a UA’s a:hover won't override  
>> the author’s a. But a :placeholder pseudo-class has the same issue. I  
>> wonder how browsers implementing placeholders with a pseudo-class have  
>> solved this. Are they violating the cascade or am I missing something?
> A UA stylesheet with an 'a:hover' rule defined should override what the  
> author has for the same property in an 'a' rule, because 'a:hover' has  
> more specificity.

This is incorrect, see  
http://www.w3.org/TR/CSS21/cascade.html#cascading-order ("Sort rules with  
the same importance and origin by specificity of selector"). Example test:

<!doctype html>
<title>UA stylesheet rule vs. author stylesheet rule with lower  
* { display: inline; }
head { display: block; }
<p>This text</p>
<p>should be on one line.</p>

Øyvind Stenhaug
Opera Software ASA
Received on Thursday, 24 January 2013 10:04:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:25 UTC