How to make containing div stretch vertically to accommodate floating image

Here's the main problem:

alt text http://img241.imageshack.us/img241/3800/problemwithfloats.png

I want the div to have the image stretch vertically to fit it.

+4
source share
2 answers

give overflow div (nice rime): hidden

+2
source

Add the following CSS separator to the div container:

overflow: auto; 

In addition, it seems that you need to specify the width for the container div if you want the solution to work correctly in Opera and IE for Windows.

See http://www.quirksmode.org/css/clearing.html for more details.

Steve

+4
source

Source: https://habr.com/ru/post/1286185/


All Articles