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

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -