Re: Inverted text

From: Matthew Brealey <>
Date: Thu, Apr 27, 2000, 11:42 AM

> [This thread addresses something I was concerned with anyway, but I've
> been away for a while and haven't had a chance to propose it before.]
> Although the UI extensions proposal quite rightly introduces a
> :selection pseudo-element (although it is actually also a pseudo-class),

It is a pseudo-element, because it can not only be a fraction of one element
(e.g. not a complete/whole element), but it can span pieces of several
elements e.g. the following markup

<p>a paragraph</p>
<div>a div</div>

could be selected like this ([] used to denote selection range)

 a [paragraph
 a] div

which then has the following "imaginary" markup (which can only be used for
illustrative purposes, since the "pseudo:selection" element is invalidly a
child of two elements):

<p>a <pseudo:selection>paragraph</p><div>a</pseudo:selection> div</div>

> it doesn't address the issue of the colours of the selection that the
> concept implies, and in particular the inverse video effect typically
> used. Although it is possible if one has specified (for example) P
> {color: black; background: white}, to say :selection {background: white;
> color: black} this doesn't address the fact that UAs at present will
> invert colours of selected items, and that there is no way of specifying
> this as things stand.

True, I believe Ted Wugofski has also pointed this out.

> They actually have something like :selection {background: invert; color:
> invert}.

I think this works actually, and manages to efficiently re-use the 'invert'
value from outline-color.

> This value I propose would only apply to elements whose targets
> are pseudo-classical (!) such as :selection and :focus, on which it
> would apply to invert the normal colours. On other selectors it would be
> ignored.

There is no need for this limitation.  In fact, the "inversion" can simply
apply to whatever is underneath.

In the case of a pseudo-element, that is the element itself, so
background:invert on the pseudo-element performs an inversion of the
background of the element (e.g. white to black), and then the color:invert
on the pseudo-element performs an inversion of that inverted background
(e.g. black to white).


You find this.  What would you do?

Received on Wednesday, 16 August 2000 04:12:10 UTC