Answer the question
In order to leave comments, you need to log in
Division not working in LESS?
Here's a mixin:
.grid(@columns, @i: 1) when (@i <= @columns) {
.col-@{i} {
max-width: percentage(@i / @columns);
padding: 0 @15px;
flex: 1;
}
.grid(@columns, @i + 1);
}
.grid(@columns);
Answer the question
In order to leave comments, you need to log in
It helped to parenthesize the division percentage((@i / @columns))
If you define @columns
and remove the dog from 15px, then everything works:
@columns: 5;
.grid(@columns, @i: 1) when (@i <= @columns) {
.col-@{i} {
max-width: percentage(@i / @columns);
padding: 0 15px;
flex: 1;
}
.grid(@columns, @i + 1);
}
.grid(@columns);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question