html - When will a div collapse when applying CSS style? -


sometimes div collapses when styling. i've known floating children make parent div collapsed , same margins shared 2 divs. some demos

is there other case make div collapsed when using css?

by collapsed mean want make parent div visually contain children? second box in example.

if so, solution clear elements after float.

just add:

.container{ clear:both; } .children { float:left; } 

Comments

Popular posts from this blog

javascript - Trigger mouseenter when an animated element touches mouse -

json - Zend error Connection -

java - Using Spring @Transactional with a combination of readOnly and write, when does this entity get committed? -