W3C home > Mailing lists > Public > www-style@w3.org > February 2014

Re: [selectors-nonelement] First draft of a new spec for selecting non-element nodes

From: Xidorn Quan <quanxunzhen@gmail.com>
Date: Sat, 15 Feb 2014 14:10:03 +1100
Message-ID: <CAMdq698+QkgrxsMZ-ON02J3+A2+ULJry5zHoijM4jE2qWj-mZA@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Andrew Fedoniouk <news@terrainformatica.com>, Daniel Glazman <daniel.glazman@disruptive-innovations.com>, www-style list <www-style@w3.org>
On Sat, Feb 15, 2014 at 2:03 PM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
> On Sat, Feb 15, 2014 at 1:30 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Fri, Feb 14, 2014 at 6:28 PM, Andrew Fedoniouk
>> <news@terrainformatica.com> wrote:
>>>>> I can imagine something like this:
>>>>>
>>>>> input[type=number]:empty::attr(placeholder) {
>>>>>   display:block;
>>>>>   color:grey;
>>>>> }
>>>>
>>>> What is this supposed to do?
>>>
>>> When <input type=number> is empty show
>>> content of the 'placeholder' attribute in its place
>>> with the given styling.
>>
>> So it's exactly equivalent to:
>>
>> input[type=number]:empty[placeholder]::before {
>>   content: attr(placeholder);
>>   display: block;
>>   color: grey;
>> }
>
> There is no effect to apply ::before or ::after on an input element.
>
> I think what he wants is to style the display of placeholder and alt.
> But IMHO it is unrelated with the attribute selector. The correct
> method should be adding some new pesudo-elements like ::placeholder
> and ::alt instead of trying to style attributes.

In fact, in all mainstream browsers, there has been placeholder pesudo-element:

::-webkit-input-placeholder, ::-moz-placeholder, :-ms-input-placeholder

I think they can be standardized in selectors4.

And applying text-related properties to img tag directly could style
the alt text.

Regards,
Xidorn Quan
Received on Saturday, 15 February 2014 03:11:10 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:19 UTC