问题
I'm struggling trying to get the behavior that I want with CSS.
I created a JSFiddle here that shows my problem: http://jsfiddle.net/c2Snd/
I want my #left div's width to stretch, but only as far as the #right div.
Basically, I want my #left divs to wrap around my #right dive just like text would. So in my JSFiddle, the top 2 red boxes' width would be 50%, then the bottom red box's width would be 100%.
回答1:
Looks like you just about have it.. confused: http://jsfiddle.net/BCBd2/1/
回答2:
Well I do not know if there are any shortcuts to doing this, but try this re-Fiddle.. http://jsfiddle.net/c2Snd/1/ To make something like this you will need to use percentage in width and border-width, so they are proportional to eachother.
回答3:
Does it serves your purpose?
http://jsfiddle.net/c2Snd/2/
来源:https://stackoverflow.com/questions/10129818/div-stretch-then-wrap-around-other-floated-div