Immediate Child selector in LESS

Dave picture Dave · Nov 13, 2011 · Viewed 76.9k times · Source

Is there anyway to have LESS apply the immediate child selector ( > ) in its output?

In my style.less, I want to write something like:

.panel {
    ...
    > .control {
        ...
    }
}

and have LESS generate something like:

.panel > .control { ... }

Answer

Dave picture Dave · Nov 13, 2011

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.