Contrast specification in Style Sheets

When people suggest specifying typographic formatting in HTML, they
are now rightly told that this is an issue that is better covered in
style sheets, as HTML is concerned primarily with content, and,
anyway, it is impossible to predict the rendering capabilities of any
user agent.  This is all perfectly correct, but there are times when
the rendering of particular classes contain content in that whatever
the display chosen it is important that they be distinguishable.

Consider the following examples.

     EM.removed : text-line = through
     EM.added : font-style = italic
   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.]

     P.king : align = left
     P.queen : align = right
   <p class=king>
     King's line.
   <p class=queen>
     Queen's line.
   <p class=king>
     King's line.

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

     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

Another way would be something like:

     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

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.             |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.

Received on Tuesday, 12 September 1995 16:10:23 UTC