Why use float and clear? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why use float and clear?

I do understand how they work, and that you can use these two properties to put elements one next to another and stuff, but I really don't see why, I could do the same thing way easier with display property, if I wanted to make elements one after another for example I could make them display as table cells inside a table, I could also just use the position property, while using float the elements may don't even work the way you want them to work when the screen size changes, so why and when are float and clear properties actually gonna be useful for me?

13th Aug 2020, 10:13 AM
Karak10
Karak10 - avatar
2 Answers
+ 2
As Aaron Eberhardt as said float is mainly useful for allowing text to wrap around an element. When used with shape-around property it can really do cool things. Also, float is used to mock some common layouts in VERY old browsers.
13th Aug 2020, 10:48 AM
Ore
Ore - avatar
+ 1
As far I know float is mainly used to allow text to wrap around it. There are only few other cases where it would be useful.
13th Aug 2020, 10:17 AM
Aaron Eberhardt
Aaron Eberhardt - avatar