css float - CSS [DIV-Tableless] Stack vertically with different heights filling the gaps? -


i have different divs floating left (float:left) have different heights. need stack divs image attached:

http://www.krazy.es/images-stackov/capture-divs.jpg

it looks div "container 5" has clear:left; or clear:both; set in css.

edit

nevermind, have divs floated left. here's sample code:

sample code on jsfiddle.net

if play width of window, you'll notice divs attempt fill available horizontal space. messiness seeing results divs having different vertical heights. desired results if:

  1. they had same height (i.e. had 2 lines of text)
  2. you assigned height value each div height:90px; (set largest common denominator)
  3. or you decided have 3 columns of divs max, if browser window wide enough accommodate more. can put container 1, 2, & 3 in 1 div on top, , container 4, 5, & 6 in div underneath
  4. finally (for completeness), you can put container 1 & 4 in div, container 2 & 5 in div, , container 3 & 6 in div, , float divs left. give 3 columns, it's restrictive, , don't recommend (you can set height on floated divs better alignment).

option #2 favorite.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -