I am working on an HTML / CSS project. I want to create classes for labels and texts based on color. for example
text-red{
color: red;
}
label-white{
color: white;
}
To do this, I am trying to create a mixin that takes a name and color as an argument and creates this class. I wrote the following mixin:
.mixin(@name, @color) {
.text-@{name} {
color: @color !important;
}
.label-@{name} {
color: @color !important;
}
}
.mixin('white', white);
This gives me the following conclusion
.text-'white'{
color: #ffffff
}
If I run this mixin as .mixin (white, white); I get
.text-#ffffff{
color: #ffffff
}
How to create a class like text-white using mixin?
source
share