CSS - 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. Similar TutorialsI want to build a style switcher for my site, to allow users to change color schemes, font sizes, etc. But I hate duplicating data, and having all those style sheets that are basically identical except for the color styles worries me. Is there some way that I could set the colors to variables (ie, $dark, $medium, $light) and then use the variables to define the styles? That way I could stay with just one style sheet. Any ideas? Thanks, Daniel hey all, does anyone know if its possible to send variables to css, so for instance i want to have the background be blue instead of orange for a specific person so i send it a variable wich includes the hex for the background-color. i know other ways of solving this but i was just wondering if anyone new if this was possible? thanks - legit Hello people I know it can be done with PHP but here goes anyway : .dude {color: #F43435 }; .dude2 {background-color: ******}; Is there a way to refer to .dude.color ??? Something like : .dude2 { background-color: .dude.color; } What I am trying to get is the functionality of defining a "constant" colour which then can apply to the multitude of other CSS classes I have... Any ideas? Thanks in advance, Angelos |