Consider the following examples.
<style>
EM.removed : text-line = through
EM.added : font-style = italic
</style>
...
The minimum fine will be <em class=removed>fifty</em>
<em class=added>one hundred</em> dollars.
[Yes, I know that explicit markup was added in HTML 3.0 to cover this
case. Pretend that it hadn't been.]
<style>
P.king : align = left
P.queen : align = right
</style>
...
<p class=king>
King's line.
</p>
<p class=queen>
Queen's line.
</p>
<p class=king>
King's line.
</p>
In each of these cases, it does not really matter what markup is
chosen for the contrasting content, but it is vitally important to the
content that they contrast. Unfortunately, there appears to be
nothing in the current draft which would tell a browser which
contrasts are important if the requested style cannot be applied.
Consider the case of a style sheet which defines classes to be
rendered bold, italic and underlined on a device which can render bold
and underlined, but not italic. The easiest solution is to punt on
the italics and render the text in roman, but this may fail
importantly to contrast with background text. Another solution might
be to follow the typewriter convention and render the italics as
underline, but this leaves the second and third classes
indistinguishable. It seems reasonable to allow the author to specify
"the second and third classes must contrast with each other and with
background text, and the first need only contrast with background
text". In this case, the browser would know that it should probably
render the second class in bold to preserve the contrast with both the
underlined and background text.
The most straightforward way to do this is probably something like
<style>
EM.class1 : font-weight = bold
EM.class1 : contrast-with = P
EM.class2 : text-style = italic
EM.class2 : contrast-with = P
EM.class3 : text-line = under
EM.class3 : contrast-with = P & EM.class2
</style>
Another way would be something like:
<style>
HTML : contrast-class = background
EM.class1 : font-weight = bold
EM.class1 : contrast-with = background
EM.class1 : contrast-class = c1
EM.class2 : text-style = italic
EM.class2 : contrast-class = c2
EM.class2 : contrast-with = background & c3
EM.class3 : text-line = under
EM.class3 : contrast-class = c3
EM.class3 : contrast-with = background & c2
</style>
I'm not really satisfied with either of these solutions, but I think
that something in this direction needs to be specifiable, so I throw
the problem out. As a language designer, it seems more reasonable to
define that a class is in a particular contrast group and that certain
groups need to contrast with one another (rather than classes
explicitly contrasting with other classes or groups), but I don't see
an easy way to specify that in the CSS paradigm.
What do you think?
----
Evan Kirshenbaum +------------------------------------
HP Laboratories |You gotta know when to code,
1500 Page Mill Road, Building 4A | Know when to log out,
Palo Alto, CA 94304 |Know when to single step,
| Know when you're through.
kirshenbaum@hpl.hp.com |You don't write your program
(415)857-7572 | When you're sittin' at the term'nal.
|There'll be time enough for writin'
| When you're in the queue.