Immediate Child selector in LESS
The correct syntax would be following while using '&' would be redundant here.
.panel{
> .control{
}
}
According to less guidelines, '&' is used to parameterize ancestors (but there is no such need here). In this less example, &:hover is essential over :hover otherwise it would result in syntactic error. However, there is no such syntactic requirement for using '&' here. Otherwise all nestings would require '&' as they are essentially referring to parent.
The official way:
.panel {
& > .control {
...
}
}
&
always refers to the current selector.
See http://lesscss.org/features/#features-overview-feature-nested-rules
UPDATE
Actually, the code in the original question works fine. You can just stick with the >
child selector.
Found the answer.
.panel {
...
>.control {
...
}
}
Note the lack of space between ">" and ".", otherwise it won't work.