stephmoreland
stephmoreland

Reputation: 4163

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.

Thanks in advance!

Upvotes: 3

Views: 4270

Answers (2)

ajcw
ajcw

Reputation: 23804

This is a good example that explains the theory

http://www.smashingmagazine.com/2009/10/19/the-mystery-of-css-float-property/

Upvotes: 0

meder omuraliev
meder omuraliev

Reputation: 186552

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

Upvotes: 7

Related Questions