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:
it looks div
"container 5" has clear:left;
or clear:both;
set in css.
edit
nevermind, have divs floated left. here's sample code:
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:
- they had same height (i.e. had 2 lines of text)
- you assigned height value each div
height:90px;
(set largest common denominator) - 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
- 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
Post a Comment