Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling lists with natural behaviour

Tags:

css

I want to style a css list like this

[ 1 ][ 2 ]
[ 3 ][ 4 ]
[ 5 ][ 6 ]

Which is basically no problem when using float:left But there is a problem, when [ 4 ] is heiger than 3 the following happens:

[ 1 ][ 2 ]
[ 3 ][ 4 ]
     [   ]
[ 5 ][ 6 ]

But i want to behave it like this:

[ 1 ][ 2 ]
[ 3 ][ 4 ]
[ 5 ][   ]
[ 7 ][ 6 ]

Please take a look at the problem: http://xbox360livegold.nl/gastenboek

like image 504
Nico Avatar asked Nov 22 '25 03:11

Nico


1 Answers

I don't think you'll be able to do this in pure CSS unless you know ahead of time what each item is going to look like, and I'm assuming this is for the news feed section on the site you lined to. You might be able to use something like the JQuery Masonry library to accomplish it.

like image 153
Emily Avatar answered Nov 23 '25 20:11

Emily



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!