W3C home > Mailing lists > Public > www-style@w3.org > March 1999

Re: a simple question

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Tue, 9 Mar 1999 12:17:35 -0500 (EST)
Message-Id: <199903091717.MAA22444@login1.fas.harvard.edu>
To: www-style@w3.org
Ian Hickson wrote:
> Well, 'transparent' *can* be used, provided everyone follows Todd's
> "reasonable and prudent" notion.

Let me try and expand this notion a bit, and see what you all think of
the specifics.  I've been thinking about this issue (since before the
discussion), and I think I'm currently leaning towards the following:

1. color/background pairs should *always* be specified together so that
no rules from another origin may get between them in the cascade.  They
may have different specificities, for example:

H1 {
   background: black;
   color: white;
   }

H1.warn {
        color: red;
		}

would be acceptable.  They should never be different weights, because
then levels of cascading can conflict (even in author stylesheets, for
CSS1 compatibility).

2. User stylesheets, whenever they specify colors with non-important
weight, should specify color/background pairs without using inherit or
transparent.

3. If user stylesheets specify any color/background pair with
important weight for an element, then they should specify the same
color for all descendants (using the universal selector and possibly
other selectors) of the element and transparent (not inherit) for all
descendants of the element.  Trasparent should be used so that
positioning does not lead to covering of text.  For example:

P {
  color: black ! important;
  background: white none ! important;
  }

P * {
  color: black ! important;
  background: transparent none ! important;
  }

P A:link { color: blue ! important; }
P A:visited { color: purple ! important; }
P A:active { color: red ! important; }

4. Author stylesheets should always specify color/background in pairs.
However, given the rules above, authors can use inherit or transparent,
provided they have explicitly set the background (or color, if
inheriting color) on the parent element.  The color is explicitly set
on an element even if inherit or transparent is used, as long as the
color/background of the parent of that element was also explicitly set
(a nice recursive definition).  Thus if a user stylesheet overrides the
color on which the author depends (using inherit/transparent), the user
stylesheet will also override the colors of the element where the
author creates this dependence.  Thus there would be no problem.

This allows authors to use transparency, which is often needed for good
use of absolute positioning.

5. The rule

(any selector) {
  color: inherit;
  background: transparent none;
  }

is always acceptable, for any weight, origin, or selector.  (Perhaps
there are some somewhat obscure reasons why one might want this.)

What do you think of these rules?  I'm working on a web page on user
stylesheets (if I ever have time to write the rest of it), and I hope
to include guidelines along these lines.

David Baron

-----------------------------------------------------------------
L. David Baron    Freshman, Harvard    dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.  < http://www.fas.harvard.edu/~dbaron/ >
WSP CSS AC                < http://www.webstandards.org/css/ >
Received on Tuesday, 9 March 1999 12:17:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:58 GMT