Float multiple fixed-width / varible-height boxes into 2 columns

Posted by Jeremy H on Stack Overflow See other posts from Stack Overflow or by Jeremy H
Published on 2010-05-11T01:43:54Z Indexed on 2010/05/11 2:14 UTC
Read the original article Hit count: 240

Filed under:
|
|

I'll try to explain this as best I can. I have multiple divs that are fixed-width but variable height. I want to float these boxes into two columns inside a fixed-width container. What happens when a give them all a float: left value, I get something like this:

######### ######### 
# box 1 # # box 2 # 
######### # ..... # 
......... # ..... # 
......... ######### 
######### ######### 
# box 3 # # box 4 # 
# ..... # # ..... # 
######### #########
######### #########
# box 5 # # box 6 #
# ..... # #########
# ..... #
#########

(The periods are white space)

What I really would really like is the top of box 3 to touch the bottom of box 1. Any easy way to acheive this?

© Stack Overflow or respective owner

Related posts about html

Related posts about css