W3C home > Mailing lists > Public > www-style@w3.org > December 2009

shorter code with loops(?)

From: Asaf Chertkoff <asaf@freeallweb.org>
Date: Wed, 23 Dec 2009 10:44:50 +0200
To: www-style list <www-style@w3.org>
Message-Id: <1261557890.6881.18.camel@kayma-laptop>
Hi everybody,
I thought of somthing - a lot of times i found my self writing the exect
css attributes for several elements, with the different of only the name
of the element background image, like this:

#ff-title {
margin:20px 10x 0 0;
float: right;
color: red;
background:url("images/ff-title.png") 0 0 no-repeat;
}

#clouds-title {
margin:20px 10x 0 0;
float: right;
color: red;
background:url("images/clouds-title.png") 0 0 no-repeat;
}
....
...
..

#buildings-title {
margin:20px 10x 0 0;
float: right;
color: red;
background:url("images/buildings-title.png") 0 0 no-repeat;
}


etc.
is it just me that need to do those things from time to time?

anyhow, what i want to ask is if there is a simple way of doing this:

#$value=[ff-title,building-title,...,cloud-title] {
margin:20px 10x 0 0;
float: right;
color: red;
background:url("images/'$value'.png") 0 0 no-repeat;
}

of course this syntax is imagenary, but i want to know if it is possible
of doing some thing like this, and if not - maybe we can add this
prucedure do future CSS development.

thank, asaf.

-- 

Asaf Chertkoff -
0545-618339,
Skype: thechoonies
asaf@freeallweb.org, 
FreeAll Web GUILD,
http://web.freeall.org
Received on Wednesday, 23 December 2009 22:58:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:47:12 GMT