- From: <w3cstyle@karsites.net>
- Date: Sat, 23 Apr 2005 18:09:23 +0100 (BST)
- To: www-style@w3.org
Hi there. 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. 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: /* start of style sheet */ CONST: top_value = 200px, left_value = 20%, col_width = 20%, another_val = 2.5em; VAR: my_fav_color = blue, cool_border_color = white, dd_menu_top = 89px, left_margin_width = 30px, spacer_value = top_value + 30px; /* end of CONST and VAR declaration block */ #top_logo { /* display: block; item is visible */ /* display: none; item is NOT visible */ display: block; position: absolute; top: 5px; left: 1%; right 1%; width: 98%; height: 80px; border: 1px solid red; background-image: url(./triplegears.jpg); background-position: 250px; color: white; text-align: center; } #left_nav_menu { display: block; position: absolute; top: dd_menu_top; /* uses a user-defined variable */ left: 1%; width: 20%; border: 1px solid red; } /* anchor links in menus */ #left_nav_menu a { display: block; color: my_fav_color; /* user-defined variable */ background-color: transparent; text-decoration: none; font-weight: normal; margin: 2px; } #right_column { /* display: block; item is visible */ /* display: none; item is NOT visible */ display: block; position: absolute; top: dd_menu_top; /* user-defined variable */ right: 1%; width: 20%; widht: col_width; /* user-defined variable */ border: 1px solid red; } So changes to the value dd_menu_top, for example, are made in one place, at the start of the style sheet. These changes would then be reflected through the rest of the style sheet. So. if I wanted position a drop down menu system at a certain absolute pixel value on a page, all I need to do is to change the value assigned to dd_menu_top variable, at the start of the style sheet. Is this feasable in CSS 3? Kind Regards - Keith Roberts http://www.karsites.net/ SPDTool - an idea for a structured open source development CASE tool. Find out more at the above link!
Received on Sunday, 24 April 2005 01:19:42 UTC