W3C home > Mailing lists > Public > www-style@w3.org > April 2008

Overwritable keywords

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Sat, 5 Apr 2008 18:19:35 +0200
Message-Id: <3B685382-492E-4095-9DCF-6E1DD040DFFC@crissov.de>
To: CSS Style <www-style@w3.org>

Christoph Päper:
>
> My proposal is to provide authors with a set of keywords whose  
> values they can overwrite with an at-rule at the beginning of the  
> stylesheet and only for this one.

This might look something like this.

   @colors {/* not sure about the order, only HTML names in shorthand */
     #000000 #808080 #C0C0C0 #FFFFFF
     #800000 #800080 #FF0000 #FF00FF
     #008000 #808000 #00FF00 #FFFF00
     #000080 #008080 #0000FF #00FFFF
   }
     /* == */
   @colors {
     black:  #000000; gray:   #808080; silver: #C0C0C0; white:    
#FFFFFF;
     maroon: #800000; purple: #800080; red:    #FF0000; fuchsia:  
#FF00FF;
     green:  #008000; olive:  #808000; lime:   #00FF00; yellow:   
#FFFF00;
     navy:   #000080; teal:   #008080; blue:   #0000FF; aqua:     
#00FFFF;
   }

   @border-widths {1px 0.1em 0.5ex}
     /* == */
   @border-widths {
     thin:   1px;
     medium: 0.1em; /* potentially ambiguous */
     thick:  0.5ex;
   }

   @lengths {1px 1ex 1em 2em 40px 80px 400px} /* or |amounts| */
     /* == */
   @lengths {
     xx-small-length: 1px;
     x-small-length:  1ex;
     small-length:    1em;
     medium-length:   2em;
     large-length:    40px;
     x-large-length:  80px;
     xx-large-length: 400px;
   }

   @font-sizes {0.707em 0.8em 0.9em 1em 1.25em 1.414em 2em}
     /* == */
   @font-sizes {
     xx-small: 0.707em;
     x-small:  0.8em;
     small:    0.9em;
     medium:   1em; /* potentially ambiguous */
     large:    1.25em;
     x-large:  1.414em;
     xx-large: 2em;
   }

   /* somewhat clashes with |@font-face|: */
   @font-families {"Times" "Helvetica" "Courier" "Zapf-Chancery"  
"Western"}
     /* == */
   @font-families {
     serif:      "Times";
     sans-serif: "Helvetica";
     monospace:  "Courier";
     cursive:    "Zapf-Chancery";
     fantasy:    "Western";
   }

   @font-weights {200 400 700}
     /* == */
   @font-weights {
     light:  200;
     normal: 400; /* potentially ambiguous */
     bold:   700;
   }

   @list-style-types {"\25B8" "25B9" "\25A0" /* and more from CSS3  
Lists */}
     /* == */
   @list-style-types {
     disc:   "\25B8"; /* stays <glyph>ic */
     circle: "\25B9";
     square: "\25A0";
     upper-alpha: "A" "E" "I" "O" U"; /* stays <alphabetic> */
     /* ... */
   }

   /* positioning, potentially hazardous */
   @positions {0% 100% 100% 0% 50%}
     /* == */
   @positions {
     top:    0%;
     right:  100%;
     bottom: 100%;
     left:   0%;
     center: 50%;
   }

Except for the general lengths, which are new, this should fall back  
nicely. There are other properties that may benefit from this if they  
not only took numerical or length values but keywords, too, e.g.  
'wide' for |letter-spacing|.

The shorthands are probably not all that good an idea, because often  
there are more properties than manageable. A general |@keywords| rule  
set cannot be used, because several keywords are used with different  
meaning for different properties, e.g. 'medium'.
Received on Saturday, 5 April 2008 16:20:10 GMT

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