Why does container div not wrap child divs (which overflow container)
Add overflow: auto
to class .category_border
.
Here's your updated demo:
https://jsfiddle.net/0vkzoxm3/3/
The reason your title and description overflow contains div
is because both styles have float: left
. When you float an element, it is pulled out of the normal flow. Hence, as far as the container is concerned div
, they do not exist.
The answer lies in "cleaning" the floats. There are many ways to do this. One way is to add overflow: auto
to the container. This causes the container to expand to the height of the floated elements.
Here's a bit more if you're interested:
Cleaning floats: an overview of the different clearfix methods
Good luck!
source to share