January 4th, 2004, 09:05 PM
CSS & Variables
I'm doing a site, but I'm trying to make it as modular as possible, so that when someone buys it I can change everything on the site in a very short time. I'm using CSS because its fantastic, and it makes my life a lot easier. My question is:
Can I define a variable in the HTML of a site and have the CSS objects on the page behave differently as a result. For example:
If I put in the variable, say:
Can I then have the CSS in my style.css sheet say something like:
and have it fill in the colour on-the-fly.
border-bottom: 1px dotted #6699CC;
It would mean that I can change the colours of the colour coded parts of the site (the text, table borders, etc.) in one easy step, and that'd be fantastic!
Thanks in advance for any help.
January 5th, 2004, 12:55 AM
umm...if you have access to server-side languages maybe..
January 5th, 2004, 07:49 AM
mmmmmmh... a ruin for webdesigners and for surprising websites. but the question itself is challenging...
as such, no, you cannot. But you could create an executable file (a software, really) "template generator" that would ask you to fill in all the values for the variables like the "pagecolour" one, and then generate the pages and the CSS stylesheets on the fly on your desktop. This system, correlated to a database, containing the content.
and then upload the template where you want.
but really, dreamweaver MX is a good tool for those wanting to use templates and dynamic content.
January 7th, 2004, 08:49 AM
I don't know if this helps you but somewhere on thsi forum I read about how to make different stylesheets for a website so you copy the stylesheet blue.css rename it to green.css and the only thing you change inside is the main color from blue to green. Then you only have to find a way to let the visitor choose which css file to use.
I know there are ways to do that, but seems like it is very browser dependant. just search dev shed I know I read it somewhere here.
January 9th, 2004, 07:50 PM
if ya want it, i can have it for ya