Re: [css4-ui] ::tooltip

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

> Or we we could implicitly by default grab whatever the UA puts into tooltips (typically the 'title' attribute content), the way ::first-line provides its own content.

Yes, this would be the best way to go - have 'normal' compute to
'none' or a string based on whether the host language says the element
has a tooltip.

> But pulling in content from other sources too would be a powerful and useful feature. With region's 'flow-from', the tooltip could be more than just a string of text.

Yup.

~TJ

Received on Friday, 13 April 2012 15:14:58 UTC