Fw: first-word pseudo-element

[ Apologies to Andrew... in a moment of stupidity I sent this to him
personally rather than to the list]


a ":from-content" selector would also have uses.

 For example, in XML:

 <balances>
   <balance date="...">£x.xx</balance>
   <balance date="...">-£x.xx</balance>
</balances>

 together with styles of:

 balance { color:#000; }
balance:from-content("-") { color:#F00; }

would colour negative balances in red and positive balances in black (as
there is no "-" character) without relying on markup to do it. This is
purely presentational - machine-readers would be able to detect the presence
of the minus character and act accordingly - and so should be achievable
using CSS alone. Doing something like adding an extra attribute to the
balance element to achieve this is just polluting the markup to achieve the
desired presentation.

I can think of more than one instance of my previously wanting to color
sections of text for presentational needs without resorting to markup, that
would have been made possible with these selectors.

- Chris Mannall.

> ----- Original Message -----
> From: <andrew.robertson@capitaes.co.uk>
> To: <www-style@w3.org>
> Cc: <sean@mysterylights.com>; <glazman@netscape.com>
> Sent: Thursday, May 17, 2001 2:54 PM
> Subject: Re: first-word pseudo-element
>
>
> > >You might consider a "to-content" selector then, where it applies style
> > until the first occurance of a certain character, or set of characters
> (non
> > inclusive). "First word" would be like :to-content(" ") or whatever. ]
> > That sounds like a good idea.
> > Andy R
> >
> >
>

Received on Thursday, 17 May 2001 10:47:26 UTC