Why parent div height become zero when we apply float on child divs. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why parent div height become zero when we apply float on child divs.

This is my code. https://code.sololearn.com/Ww2Qi1Xuag9H/?ref=app

24th Dec 2019, 10:29 AM
Maninder $ingh
Maninder $ingh - avatar
4 Answers
+ 3
Gordon I found the answer by using this it work. #main::after{ content:" "; display:block; height:0; clear:both; }
24th Dec 2019, 11:48 AM
Maninder $ingh
Maninder $ingh - avatar
+ 4
Gordon I know but i want to use float because float is supported in Internet explorer and in edge.grid and flex is partially supported by these browser.even with prefixes is not completely working.
24th Dec 2019, 10:53 AM
Maninder $ingh
Maninder $ingh - avatar
+ 2
use flex or grid instead
24th Dec 2019, 10:38 AM
Gordon
Gordon - avatar
+ 2
set height at parent
24th Dec 2019, 11:35 AM
Gordon
Gordon - avatar