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.

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.

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

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


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.