Can you add an active state on the same line as a hover state in [less] or does it have to be nested on line separate lines?
example:
standard less
nav {
color:@black;
display:block;
&:hover {color:@primary-color;}
&:active {color:@primary-color;}
}
somehow to do this
nav {
color:@black;
display:block;
&:hover, &:active {color:@primary-color;}
}
I've tried: [&:hover, &:active;] I've tried: [&:hover; &:active;] but it's doesn't seem to work.
Actually yes you can, and the second variant you provided is correct as long as you define the @primary-color
variable:
@primary-color: #f00;
@black: #000;
nav {
color: @black;
display:block;
&:hover, &:active {color:@primary-color;}
}
will produce:
nav {
color: #000000;
display: block;
}
nav:hover,
nav:active {
color: #ff0000;
}
It's late and my stupidity tells me to go to bed.
Juicy Scripter get's the win, I get the lose for back coding mistakes.
But yes,
nav {
color: @black;
display:block;
&:hover, &:active {color:@primary-color;}
}
Is the answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With