I have some div
s, and I want them to start filling the main div
vertically, and then cause the main div
to scroll horizontally.
Currently, I'm using float:left
on child div
s, but it does exactly the opposite: it starts filling the main div
horizontally, and then the main div scrolls vertically.
The number of rows may differ based on screen size, so I can't create a table for this purpose.
table + some javascript hacks may allow me to do this, but I prefer a CSS (without any javascript) way. Because this code will run on mobile apps, and javascript will slow down the web app.
This is my current code, and here's the result of my current code. But I want something like this.
UPDATE: As @goliney suggested, seems that it can be done with css-columns
. I created this example right now.
Now, there are these two problems:
While it's working good, it still needs some javascript to determinate number of visible columns (column-count) in the page. Although it's a minor javascript process, is there any way to do it in CSS, too?
Also, I prefer to show a little bit of fifth column, so user can know that this list is scrollable horizontally. But
columns-count
can't accept some float value (like4.2
), it only accepts integer values. So how can I do it?