Factsheet
Videos
Explain Like I'm Five: What is SASS and LESS?
css selectors - What does "&" do in LESS CSS? - Stack Overflow
html - What is a Less file? - Stack Overflow
Use LESS to make CSS development suck less (part III)
Not to mention the use of // as comments. Woot!
More on reddit.comSomething to do with css but that's as far as I am at this point in time.
I know you can do something like
&:hover, but not familiar with showing a class right after it?
It's the same logic here: chaining the inner selector to whatever is represented by the outer selector. Pseudo-classes like :hover and classes like .flex-active behave the same with &.
Compiling that to CSS will result in a rule with the selector
Copy.controls-container .flex-control-nav li a.flex-active
The & appends the parent nesting structure where ever the & may occur. So as others have noted, putting the & in your example takes the full nested string of .controls-container .flex-control-nav li a and replaces the & in your code to (in this case) cause the .flex-active class to be conjoined to the a tag...
Copy.controls-container .flex-control-nav li a.flex-active
...instead of a child of the a tag...
Copy.controls-container .flex-control-nav li a .flex-active
If you just think of it as a "string replacement" for a selector, it will help you visualize. For instance this (note where I have put the &)...
Copy.controls-container {
.flex-control-nav {
li a {
.flex-active & {
filter: none;
background: @color_links!important;
}
}
}
}
...would produce this selector...
Copy.flex-active .controls-container .flex-control-nav li a
...as it would append the nested structure after the class .flex-active.