开发者

Less.js - strong nested rules?

开发者 https://www.devze.com 2023-04-10 12:12 出处:网络
I love the ability of less.js to make nested rules. For example .A{ .B{ width:50px; } } which results in .A .B{

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!


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消