Open In App

What is use of the float Property in CSS ?

The float property in CSS is used to specify how an element should be positioned within its containing element concerning the flow of surrounding content. It’s often used for creating layouts where elements can be moved to the left or right, allowing content to wrap around them.

Syntax

/* Example of using the float property */
.element {
float: value;
}

Common float Property Values:

The table below illustrates float property values along with their descriptions.

Float Value Description
left The element is floated to the left, allowing content to flow around its right side.
right The element is floated to the right, allowing content to flow around its left side.
none The default value. The element does not float, and content does not flow around it.
inherit The element inherits the float property from its parent element.

Features:

Article Tags :