Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Is there a way to declare the following:

body.someclass { @maincolor:#somecolor;}
bidy.anotherclass { @maincolor:#anothercolor;}

also tried:

 body.someclass {.maincolor {color:#somecolor;} }
 body.anotherclass {.maincolor {color:#anothercolor;} }

I'm working on a website where each of there mainsections uses a different color... would be extremely helpfull :)

share|improve this question
    
Have you looked at the examples in the documentation? –  xec Jul 5 '13 at 11:22
1  
It's not clear what you're asking. You want variable property names? –  onetrickpony Jul 5 '13 at 11:23
add comment

1 Answer

This code should work.

@color: #4D926F;
@color2: #000000;

body.someclass {
  color: @color;
}

body.anotherclass {
  color: @color2;
}
share|improve this answer
    
thx for the quick reply... however, this way, all elements (body, p, h1 > ..., ... ) are assigned with color:#4D926F. –  Koen Bulens Jul 5 '13 at 11:33
    
See my edit. Just add another variable. –  Doink Jul 5 '13 at 11:39
    
: ) different color... still all elements –  Koen Bulens Jul 5 '13 at 11:45
    
@KoenBulens: You probably need to update your question and be more clear what you are after. Any color setting to the body element is going to inherit to "all elements" that do not set there own color simply by CSS rules (regardless of LESS). So what are you trying to achieve by setting color on the body element that is different from what Doink has offerred here? –  ScottS Jul 5 '13 at 15:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.