Why does my div not expand to the size of the content
I'm pretty sure that I'm supposed to use a clearfix or something to remedy this, but I have been fighting with this layout for too long and I'm going cross-eyed from the code so bear with me.
My example shows what happens when the far right column (#rightbox
) has too much information and it breaks out of the main wrapper (#interior_wrap
).
Because #rightbox
is floated, I'm sure that's what's causing it, but I think I'm too close to see the solution so any help would be great.
Than开发者_如何学JAVAks in advance!
ah, the most asked css question on SO..
#container { overflow:hidden; zoom:1; }
or #container:after { content:""; clear:both; display:block; }
if you get clipping.
PS - do not use position:absolute to center things, use margin:0 auto
This is a good example that explains the theory
http://www.smashingmagazine.com/2009/10/19/the-mystery-of-css-float-property/
精彩评论