How to make columns automatically wrapping when there’s not enough space in the viewport

I have this layout and I dont want to use media queries… how to make responsive by making the boxes wrap when there is not enough space in viewport: