I have many divs with variable height. I need these divs sort under each other but when they will reach end of window –> create new "column".
Now divs are overflowing, but I need to create new "column".
BTW:
I have solution using:
-webkit-column-gap: 16px;
-webkit-column-width: 230px;
But I need to support other browsers.
Thank you for your help!
To do it with CSS only,
an option would be using
column-count
and amax-height
on the container.see DEMO
but I am not sure about browser sopport.
It kinda does what you want, at least to some extend, but you would probably be better of with something in javascript.
EDIT: here I paste the CSS:
Try something like this: Where maxHeight is exactly equal to height of the window.
The Javascript to loop through this will require a bit of attention but it is plenty possible.
The another way to solve this issue is using jQuery to get available window height and create each column based in this information. In other way, but still using jQuery, is you use Mansory jQuery (http://masonry.desandro.com/) plugin or Isotope (http://isotope.metafizzy.co/).