.less incompatible with nth-child selector

1,066 views
Skip to first unread message

Domenic Denicola

unread,
Apr 24, 2010, 7:44:30 AM4/24/10
to DotLess (Less Css for .NET)
The following CSS gives an empty output after being run through
the .less compiler:

li:nth-child(1)
{
color: blue;
}

Very sad :(.


--
Subscription settings: http://groups.google.com/group/dotless/subscribe?hl=en

Daniel Hölbling

unread,
Apr 24, 2010, 7:48:43 AM4/24/10
to dot...@googlegroups.com

Hmmm.. thats due to the fact that it looks to the Compiler like a mixin with arguments. .. i guess we have to look for a vardecl inside the braces

them...@gmail.com

unread,
May 19, 2013, 3:06:24 PM5/19/13
to dot...@googlegroups.com, dom...@domenicdenicola.com
Any update about nth-child in less?
Message has been deleted

tluese...@gmail.com

unread,
Aug 8, 2013, 4:27:45 AM8/8/13
to dot...@googlegroups.com, dom...@domenicdenicola.com
Probably this will work:

li{
       &:nth-child(1){ 
    color: blue;
       }
}

 

 

Theme Rox

unread,
Aug 10, 2013, 12:42:45 PM8/10/13
to tluese...@gmail.com, dot...@googlegroups.com, dom...@domenicdenicola.com
Hi,
For current in rox_menu.css we had applied like this if you want to do it by less then your is the way to do.Make sure with the main li class.
Css code
.gf-menu.l1 li:nth-child(1){background:#e99a1e;}
.gf-menu.l1 li:nth-child(2){background:#b01a40;}
.gf-menu.l1 li:nth-child(3){background:#46aa1f;}
.gf-menu.l1 li:nth-child(4){background:#408afa;}
.gf-menu.l1 li:nth-child(5){background:#d24726;}
.gf-menu.l1 li:nth-child(6){background:#e99a1e;}
.gf-menu.l1 li:nth-child(7){background:#46aa1f;}
.gf-menu.l1 li:nth-child(8){background:#b01a40;}
.gf-menu.l1 li:nth-child(9){background:#408afa;}
.gf-menu.l1 li:nth-child(10){background:#d24726;}
.gf-menu .dropdown ul li{background:none !important}
.gf-menu.l1 li:nth-child(1) div.dropdown{background:#e99a1e;}
.gf-menu.l1 li:nth-child(2) div.dropdown{background:#b01a40;}
.gf-menu.l1 li:nth-child(3) div.dropdown{background:#46aa1f;}
.gf-menu.l1 li:nth-child(4) div.dropdown{background:#408afa;}
.gf-menu.l1 li:nth-child(5) div.dropdown{background:#d24726;}
.gf-menu.l1 li:nth-child(6) div.dropdown{background:#e99a1e;}
.gf-menu.l1 li:nth-child(7) div.dropdown{background:#46aa1f;}
.gf-menu.l1 li:nth-child(8) div.dropdown{background:#b01a40;}
.gf-menu.l1 li:nth-child(9) div.dropdown{background:#408afa;}
.gf-menu.l1 li:nth-child(10) div.dropdown{background:#d24726;}

Thanks


On Thu, Aug 8, 2013 at 2:24 PM, <tluese...@gmail.com> wrote:


Am Sonntag, 19. Mai 2013 21:06:24 UTC+2 schrieb them...@gmail.com:
Any update about nth-child in less?

    I cant remember to have any kind of problem with nth-child but probably this will work: 
li{
       &:nth-child(1) {
        color: blue;
       }
}




--
Thanks
CEO
ThemeRox

Reply all
Reply to author
Forward
0 new messages