Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Less.js - strong nested rules?

Tags:

css

less

I love the ability of less.js to make nested rules. For example

.A{
    .B{
        width:50px;
    }
}

which results in

.A .B{
    width:50px;
}

But is there a way to make it result in this:

.A > .B{
    width:50px;
}

I´ve already tried to do this:

.A{
    &>.B{
        width:50px;
    }
}

But it does not work...

Thanks!

like image 785
Van Coding Avatar asked Oct 03 '11 12:10

Van Coding


1 Answers

It's as simple as this:

.A {
    > .B {
        width: 50px;
    }
}

Another related question: Immediate Child selector in LESS

Some documentation: http://lesscss.org/features/#features-overview-feature-nested-rules
(doesn't actually include relevant example)

like image 116
thirtydot Avatar answered Nov 11 '22 14:11

thirtydot