Reputation: 1819
I have some LESS styles similar to the following. Is there a technique in LESS that better handles what I am trying to achieve without having to duplicate the class name under each parent element?
span {
.zero {
color: #fff;
}
}
div {
.zero {
color: #389c40;
}
}
Upvotes: 1
Views: 344
Reputation:
Well, you could always do
.zero {
span & { color: #fff; }
div & { color: #389c40; }
}
Upvotes: 2
Reputation: 82
Try using css variables:
:root{
--zColor: #fff;
}
.zero{
color: var(--zColor);
}
div{
--zColor: #389c40;
}
Upvotes: 2