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

Re: User constant declarations in style sheets

From: David Woolley <david@djwhome.demon.co.uk>
Date: Sun, 24 Apr 2005 08:01:48 +0100 (BST)
Message-Id: <200504240701.j3O71mq00596@djwhome.demon.co.uk>
To: www-style@w3.org

> I was wondering if it would be possible to implement the 
> declaration of constants and/or variables at the head of 
> each external and internal style sheet.

This is regularly proposed and rejected.  At least you have
made the scope of the identifiers clear (single file).
Basically, with file scope, the right place to do this is in the
authoring tool, so that the resolved variables are sent over
the wire.  This also has the advantage of backwards 
compatibility.

> 
> Eg. for positioning div blocks, instead of having to hard 
> code the top: and left: property value in each rule 
> declaration, what about something like this:

Have you tried listing multiple selectors against one rule; that is
the standard CSS way of handling this.  Remember that you don't need
to give all the rules for an object in one place.

Also remember that you can have multiple class names on an element,
so, if your styling bears some resemblance to following function, you
may well be able to avoid repetition by having general and specific
classes (e.g. menu and navigation).

Incidentally, you shouldn't have classes called top_logo, as you are
putting assumptions about the presentation into the structural part
of the document.  (px units are also generally undesirable, because 
the page can become unusable when users override font sizes.)
Received on Sunday, 24 April 2005 07:06:10 GMT

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