I am trying to create a wordpress theme. i would like to have three columns with post excerpts. But the problem is that they don't always have the same height (and i don't want them to), so when in one row a post is too high, the next row will start too far away.
Hmmm, i can really explain it, so i created this fiddle to show what i mean:
//in the fiddle there is html and css making a clear example of what i mean
As you can see post id#5 is too long, so post #7 doesn't go any more under post #4.
What i would like is to find a solution where the post always "go up" to the previous post in that column. If possible, without any plugins...
Any ideas?
To create a dynamic column height no matter if it's images/posts/products, you can apply Masonry JS
This JS offers you the possibility to fit each new div under the previous div from the above line, and has a great effect of showing it.
Here is a PHP + CSS based solution:
PHP:
And then use CSS to clear the float for every .column_1.
CSS:
I used similar approach in multiple projects and it worked. The code above may need to me modified a bit to work for your specific theme, but I hope you'll get the main idea.
It will work immediately after page + CSS load (no waiting for JS to load)! :-)