Re: [css4-ui] ::tooltip

On Apr 13, 2012, at 8:14 AM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:

> On Fri, Apr 13, 2012 at 6:32 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
>> For some pseudo-elements, you can grab content from elsewhere. We have 'content' and 'flow-from' (regions) that could provide that content for '::tooltip'. 'Content' could grab it from the 'title' attribute, like this:
>> 
>> div::tooltip { content: attr(title); background: gold; font-size: x-large;  }
>> 
>> In this case, if no title attribute exists, then there is no content. If there is no content, then the pseudo-element does not appear (just as with '::before' and '::after'). So we don't actually need '[title]' in the selector.
> 
> Actually, you do, as attr() will return the empty string in that case,
> and the empty string is a valid value for 'content' that should cause
> it to be generated.  

Is that considered useful? Why not null if the attribute doesn't exist, and empty string it exists with no value or empty value?

> Not all browsers agree on this, though - Chrome
> won't generate a pseudo-element in that case, but Firefox will.

Received on Friday, 13 April 2012 15:28:52 UTC