The reason that the height or containers are 0 is because you are floating all the content inside them, and the floating elements do not extend the height (or width) of their parents.
When you float all the elves in row , it has 0 height and therefore has .container .
To prevent this, you can:
- install
overflow:hidden; in containers demonstration - clear the float with the block element at the end of the container with
clear:both; demo
You can also check this question for reference: How do you keep parent elements in floating elements?
web-tiki
source share