- From: Coises <Randy@Coises.com>
- Date: Wed, 19 Feb 2003 15:25:16 -0700
- To: <www-style@w3.org>
[Tue, 18 Feb 2003 18:16:30 -0800] Tantek Çelik: >It's clear that fantasai is talking about the _CSS3_hyperlink_colors_, which >*do* have a functionally equivalent alternative as fantasai pointed out >(don't override the user's link colors). That may be easier said than done. Suppose we have a general, shared style sheet including the rules: BODY {color: silver; background: navy} A:link {color: white; background: transparent} A:visited {color: yellow; background: transparent} Now, on a particular page, in a DIV with ID "abc" we want to use the colors preferred by the user for text, page background and links. How can it be done? By rewriting the style sheet and every document to which it applies to add a class to apply the colors to everything *else*? >They have not been implemented >(AFAIK), and have not been referenced/used by any other specifications. > >I am still *for* dropping the CSS3 hyperlink colors. > >It appears that fantasai is also for dropping them. > >Does anyone else have an opinion either way? I would drop those color keywords, but I would add, at minimum, a keyword "revert" to all properties. The definition of "revert" would be that if a rule specifying "revert" has priority in the cascade for a particular property of a particular element, the value reverts to that which would have been determined had no rules from the same style sheet source (author or user) for that property been applicable to that element. Thus, the case above would be handled by: #abc BODY {color: revert; background: revert} #abc A:link {color: revert; background: revert} #abc A:visited {color: revert; background: revert} in the page's own style sheet. In a user style sheet, a "revert" rule (which was not superseded by an author style sheet rule) would restore value determined by the user agent default style sheet. (A question --- the better choice is not obvious to me --- would be whether a "revert !important" rule in a user style sheet should cancel only user style rules or both author and user style rules. A more general method would be something like this: ref( [ [ [ [ [ [ author | [#<id>|.<class>]* ] || user || system ] | initial | other | all ] || [ (<selector>) | this ] ] | inherit ] || [ [ specified | computed | actual ] || <property-name> ] ] ) author Take author style rules into account when determining the value. #<id>|.<class> Take rules from author style sheets named in <LINK> elements with the specified IDs and classes (or the equivalent in document languages other than HTML) into account when determining the value. user Take user style rules into account when determining the value. system Take user agent default style sheet rules into account when determining the value. initial Use only the initial values defined in the specification to determine the value. other Use all sources of style rules except the style sheet containing this declaration (and any style sheets it @imports). all (default) Use all sources of style rules to determine the value. <selector> Use style rules that match the given selector in the same context as the element under consideration. The selector can be only a simple-selector with an optional pseudo-element suffix. If the selector contains a type selector, the element is matched (in its place in the document tree) as if it were of the specified type; otherwise, the actual type of the element is assumed. If the selector contains an ID selector the element is matched as if it had the specified ID; otherwise its own ID (if any) is assumed. If the selector contains a pseudo-class the element is matched as if that pseudo-class applied *in*addition* to any others that may apply. Attribute selectors that specify a particular value (e.g. [ROWSPAN="2"] cause the element to match as if the specified attribute has the specified value; other attribute selectors (including HTML class selectors) are *added* to the current set of attributes: that is, [ROWSPAN] makes the element match selectors containing [ROWSPAN] (but not [ROWSPAN="2"],unless the element actually does specify ROWSPAN="2"); [CLASS~="special"] (or just ".special") causes the element to match rules for the "special" class in addition to those for any classes already specified for the element (whereas [CLASS="special"] would prevent any other classes specified on the element from being recognized). If a pseudo-element is specified, only rules for that pseudo-element are matched. Note that regardless of the selector, the virtual element constructed is matched as if it occupied the same place in the document tree as the actual element under consideration. (This could possibly be extended to allow descendant, adjacent and/or child selectors, but it would surely get very complicated.) this (default) Use style rules that match the element under consideration. inherit Use the property value determined for the parent in the document tree of the element under consideration. specified | computed | actual Use the specified, computed or actual value that has been or would be determined for the property. The default is the same as for inheritance of the source property; that is, most property/value combinations use the computed value; but a few --- for example, "line-height: normal" --- use the specified value. If the specified value for such a property is not usable as specified value for the target property then the computed value is used. <property-name> Use the value that has been or would be determined for the specified property. The default is the property to which the value is to be assigned. The keywords "inherit" and "initial" would then be special cases of ref: ref(inherit) ref(initial) and the "revert" idea above could be accomplished with: ref(user system) ref(author system) in author and user style sheets, respectively. This would also allow rules like: {border-color: ref(inherit background-color)} to assign the background-color property of the parent element as the border-color of an element; or: {height: ref(width)} to force the height of an element to be the same as its width; or: IMG {border: thin solid ref(user system (A:visited) color)} to cause images to have a thin solid border of the same color the user ordinarily sees for the text of visited links. (Combinations which are equivalent to including the default values "all" and "this" and the default value for <property> are not forbidden by the above syntax; however, they would have no effect except to cause the rule to be rejected and the next applicable rule in the cascade to be used. A system for avoiding circular references in general would also be needed.) -- Randall Joseph Fellmy aka Randy@Coises.com
Received on Wednesday, 19 February 2003 17:25:47 UTC