CSS Float | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

CSS Float

So an element that is floating left within a bigger element/container just means: The element is aligned left within it's container But every other element also inside the container can 'wrap' around it? So making an element float kinda makes it an inline element right? And to confirm, clear just tells what elements AREN'T allowed to float?

18th Mar 2019, 12:48 AM
J3fro C
J3fro C - avatar
2 Answers
+ 4
Yes, float:left makes it act like an inline element. The next element will go to the right of it, as long as it fits. If the second element doesn’t have the float:left, the floating will be done and the next element will go below it. Clear removes floating. You can specify which floating to remove. Most common is clear:both. https://www.w3schools.com/CSSref/pr_class_clear.asp
18th Mar 2019, 1:49 AM
Mike - avatar
#titanic { float: none; }
4th Nov 2019, 6:50 PM
Adao Abdala
Adao Abdala - avatar