user581157
user581157

Reputation: 1409

LessCss call css class from html code

I have a asp.net page this asp.net page changes color based on the application area there are 5 application area's each application area has its own color .

I need to change the color of the page based on the application area selected. I need to use lesscss and reuse existing css to change the color .

Is it possible to call a less css class from the html passing it the color based on the applciation area . Or any other way ?

How do i go about this ?

Upvotes: 0

Views: 94

Answers (1)

Alexander Manekovskiy
Alexander Manekovskiy

Reputation: 3203

You can create one less file that will define all your base styles that are dependent on color parameter and then, for each site area create a separate less file that will override the color and import the base file. You'll get a separate styles file for each area:

styles.less:

// Define default color value
@color: blue;
.foo {
    color: @color;
}

red-styles.less:

// import base classes 
@import "relative-path-to-base-styles\styles.less";

// override default value for color
@color: red;

Upvotes: 1

Related Questions