Looping in LESS
Looping in LESS:
.loop(@index) when (@index > 0){
  selector:nth-child(@{index}) { 
    property: @index * 1px; 
  }
  .loop(@index - 1);
}
.loop(0){}
.loop(3); // loop 3 timesRenders in CSS:
selector:nth-child(4) {
  property: 4px;
}
selector:nth-child(3) {
  property: 3px;
}
selector:nth-child(2) {
  property: 2px;
}
selector:nth-child(1) {
  property: 1px;
}Written by Jorge Epuñan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Less 
Authors
Related Tags
#less
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
