|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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: <%pagecolour%="FF0000"> Can I then have the CSS in my style.css sheet say something like: Code:
a:visited{
color: %pagecolour%;
text-decoration: none;
border-bottom: 1px dotted #6699CC;
}
and have it fill in the colour on-the-fly. 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. |
|
#2
|
||||
|
||||
|
umm...if you have access to server-side languages maybe..
|
|
#3
|
||||
|
||||
|
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. |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
||||
|
||||
|
theres also a very complex way to do it using javascript that i use on my sites and all you do is just give color values to your variables, add the actual css code generation functions below, and then youre done.
if ya want it, i can have it for ya [[[terminal]]] |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS & Variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|