Reputation: 7493
LESS has mixins which make it easy to re-use properties from one class or ID ruleset in another. Is there a way to reference properties for an element (without class or ID) inside another ruleset? I'd like to do something like:
// Defined in a base .less file somewhere
a {
color: blue;
}
// Defined within a more specific file
.myClass a {
color: red;
}
// #myElement is used within .myClass, but I'd like to re-use the
// base styles.
#myElement a {
a();
}
Upvotes: 1
Views: 29
Reputation: 23637
You can use *:extend()
pseudo-class for that:
#myElement a {
background: green;
&:extend(a);
}
See: Extend
Upvotes: 2