Re: a simple question

Ian Hickson wrote:

> The answer with 'color' and 'background-color' is to *always* specify
> them together, and *never* use 'background-color: transparent'. Also,
> if you use 'inherit' for one, use it for the other.
>
> This cannot be sidestepped by careful design of author stylesheets,
> because USERS can create their own sheets, which get cascaded in
> (this, by the way, is a good thing).
>
> Other problems include clashes with the 'display:table-*' constructs,
> and the suggested replaced content idea, and x-height adjustments,
> and, in fact, any property that depends on other properties or
> properties set in other rules.
>
>
> No one has yet suggested a workable solution to this problem.

I don't think there is a bullet-proof one. But then, people do all kinds of
complicated things every day that depend on other people doing certain other
things a certain way, and this arrangement, vulnerable as it is, rarely
precipitates the collapse of civilization. In other words, I think the
solution depends on a somewhat fuzzy notion of "reasonable and prudent"
rather than on some algorithm being implemented flawlessly.

Here's what I think is reasonable in the case of color:

"Inherit" and the universal selector are big steps forward. They will permit
authors to specify certain back/foreground color combinations only once.
Like this:

html {
     color: black;
     background: white
     }

*    {
     color: inherit;
     background: inherit
     }

a:link   {
     color: red
     }

What about user stylesheets? With the above scheme in an author sheet, the
only "clear and present danger" will be with users' "!important" bits. So
let users with such needs also use inherit and the universal selector. Here
is a sample CSS binding to the current typical "always use my colors" prefs
choice:

*    {
     color: inherit !important;
     background: inherit !important
     }

html {
     color: white !important;
     background: black !important
     }

a:link   {
     color: green
     }


Now, Netscape 4.x reads "inherit" as the hex value of the word - a cold
bright green, so "inherit" will need to be obscured/withheld from Netscape
4.x (or sent along as an encouragement to try a new browser). Netscape 4.x
doesn't implement user stylesheets anyway, so there's not much potential for
harm outside of the usual bugs.


Am I understanding "inherit" right?

--

Todd Fahrner
mailto:fahrner@pobox.com

Standardization, instead of individualization.
Cheap books, instead of private-press editions.
Active literature, instead of passive leather bindings.

    - Jan Tschichold, 1930

Received on Sunday, 7 March 1999 19:25:13 UTC