TIMEX
TIMEX

Reputation: 271614

How do I lay my DIVs in a unique grid?

Currently, my DIVS are laid out like this. It's basic float:left. Easy

http://imgur.com/FSiTs.jpg

But what if I want to turn some of those square DIVs into one that is twice as wide/long? They will be randomly selected, of course. How would I generate the HTML/javascript and do this?

http://imgur.com/XsYLV.jpg

What's the math behind this? Will float:left still work?

Can someone please give a good example of how this can be achieved easily?

Upvotes: 4

Views: 118

Answers (1)

jyoseph
jyoseph

Reputation: 5455

jQuery Masonry works well for this: http://desandro.com/resources/jquery-masonry/ (demo)

Upvotes: 2

Related Questions