Okay, I have four divs of unknown height, but fixed width. Although height is unknown, it can be assumed that div1 > div3 > div2. They are (currently) all in a row, floated. For example:
1111 2222 3333 4444
1111 2222 3333 4444
1111 2222 3333
1111 3333
1111
When I resize the viewport, I'd like the rightmost element to reposition itself, but into the "highest" possible position, and not clearing what is immediately left of it. Eg:
1111 2222 3333
1111 2222 3333
1111 2222 3333
1111 4444 3333
1111 4444
(this is not what happens under ordinary circumstances. 4 is positioned further down, such that it clears the bottom of 3)
And, on the next resize, the most "compact" arrangement, like so:
1111 2222
1111 2222
1111 2222
1111 3333
1111 3333
4444 3333
4444
(and again, 4 would be normally positioned lower down, such that it clears 3).
And lastly:
1111
1111
1111
1111
1111
2222
2222
2222
3333
3333
3333
4444
4444
I've tried some very creative arrangements, wrapping certain pairs of divs in a container div and applying different styles to that, positioning some elements absolutely, setting min / max widths on container divs, invisible shims, etc, etc. I've had success for some of these scenarios, but no solution is successful in all 4 possibilities. Any ideas? Also, I will not use javascript-- I'm looking for a pure-css solution, if it exists. Thanks