I want my container div to get the height of max of its children\'s height. without knowing what height the child divs are going to have. I was trying out on JS
The best and the most bulletproof solution is to add ::before and ::after pseudoelements to the container. So if you have for example a list like:
And every elements in the list has float:left property, then you should add to your css:
.clearfix::after, .clearfix::before {
content: '';
clear: both;
display: table;
}
Or you could try display:inline-block; property, then you don't need to add any clearfix.