One problem with putting
div floating inside a container (such as another
div) is that the containing
div does not handle the size very well and it ends up collapsing.
Let’s say you have the following HTML:
and the following CSS:
You’ll end up with with a collapsed container (in green).
overflow: auto; to the container, then it will prevent it from collapsing: