954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Wrapper not stretching?

Hi,

I have a wrapper and 2 divs inside which make use of the float property.

When I put content inside one of the sub divs, the wrapper doesn't extend to the same size as the sub divs.

Hope you can understand this.

Any idea how to resolve this?

Many thanks.

jryans10
Newbie Poster
11 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

By using float you are removing the sub div from being "inside" your wrapper. You can consider it to be "floating" on top. Because it has lifted out in this way the wrapper can't wrap itself around the div. Try replacing the float command with display:inline-block for the 2 divs - that should make them appear beside each other, which is what I think you were trying to achieve with the float.

hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 169
 

Or just add overflow:auto to the wrapper's css. That usually makes it expand properly. Sometimes overflow:visible works too.

drjohn
Posting Pro in Training
448 posts since Mar 2010
Reputation Points: 76
Solved Threads: 80
 

Thank you both very much, but I followed drjohn's advice and it works perfectly.

Thanks!

jryans10
Newbie Poster
11 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You