Make Container div Grow With Floating divs

A thing I just discovered when doing the new design for seafoid.org:
If you have a div that acts as a container for floating divs, it won’t grow with them.

Growing with floating divs

The trick is the following: insert this piece of code to the CSS of the container.

overflow: auto;
width: 100%

The width attribute is necessary for Internet Explorer versions prior to 7.

Hope that helps.

4 Responses to “Make Container div Grow With Floating divs”

  1. Pedro Barata says:

    Thank you a lot!
    I spent hours trying to do this untill i found your explanation!

    Thanks,
    Pedro

  2. Joao Joaquim says:

    just what I was looking for!
    thanks

  3. Tom D. says:

    Thank you! Thank you! Thank you! Thank you!

    I was using visible instead of auto. Works in all browsers! Second pair of eyes is always good.

  4. Dark says:

    you’re a genius! every single forum says “it can be done” or the try to do it with the position:absolute thing.

    clap clap clap! :)

Leave a Reply

Your Data

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What do you want to say?