Junior JavaScript

What is float and why is it used?

float moves elements to the left or right — allowing text and inline elements to wrap

around.

Example:

img { float: right; margin: 10px; }

Key Takeaway:

Used for text wrapping, but Flexbox/Grid is better for layout today.

More from JavaScript Tutorial

All questions for this course