The thing is that I have to distribute x-number of bricks in a grid. The rule is that I start from top-left and then spread out towards bottom right. I use javascript generated css selectors, using nth-child() selector. Actually the elements are just put out in one long sequence.