Say I have the following HTML:
<div class="bigSquare">
<div class="square0 square"></div>
<div class="square1 square"></div>
<div class="square2 square"></div>
<div class="square3 square"></div>
</div>
And the following CSS:
.bigSquare {
height: 100px;
width: 100px;
}
.square {
position: absolute;
height: 40px;
width: 40px;
}
.square0 {
left: 5px;
top: 5px
}
.square1 {
left: 55px;
top: 5px
}
.square2 {
left: 5px;
top: 55px
}
.square3 {
left: 55px;
top: 55px
}
Is it possible to reduce the square0, square1, square2, and square3 CSS down to something that looks like this?
.square[n] {
left: calc((n % 2) * 50px + 5px);
top: calc((n / 2) * 50px + 5px);
}
I realize that the % operator isn't legal but maybe there's an equivalent.