Account
Categories
Shobha
Shobha
The best way to predict the future is to invent it

How does float work in CSS?

The float property in CSS allows you to position an element to the left or right within its containing block, while the remaining content flows around it. This is commonly used for wrapping text around images or creating layouts with columns. When an element is floated, it is removed from the normal document flow, meaning it no longer affects the positioning of other elements in the layout, but the surrounding content will wrap accordingly. For example,

.left-float { float: left; }
.right-float { float: right; }

This causes the element to move to the left or right, with any text or other elements wrapping around it.