• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

parametize CSS attributes

 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so maybe it's a bit much to parametize something, that after all, is one level of parametization already. Meta-Meta-Data ?

Let's say that I have in my CSS a whole 'range' of classes...

nBodyPrimary
nBodySecondary
bBodyPrimary
bBodySecondary
iBodyPrimary
iBodySecondary
iListPrimary

well, you get the idea?

n is normal, b is bold, i is Italic, Primary and Secondary (possibly Tertiary, etc.) are the colours of the fonts. So by changing every class that ends with "Primary", I'd change the primary font colour of the site. Good for 'flavours'.

Let's say my Primary colour is orange. I'd want the colour to be #cc6600. Now I could just search and replace this with #990000 if I wanted to change my primary to red. But what about the case where I want only TEXT to change colours, and not (say) a table border or cell background. Those i still want orange.

Does CSS support the concept of parametizing, such that I could specify my class :
.nBodyPrimary{
color: %primary_colour%;
where % is my entirely imagined syntax for the CSS parameter 'primary_colour'

Perhaps someone will smack me upside the head, and tell me that I'm using CSS entirely wrong.
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike,
with actual browsers you can combine classes:

Tested with IE6 and Mozilla Firebird.
<text-module>Usual older browser constraint</text-module>
cb
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THe best way to do it is combining classes...I only found this out a coupke of weeks ago with Gregg asking a question. You can change the css code with javascript, but you can not permanently change it.
Eric
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic