Open In App

What is use of the float Property in CSS ?

Last Updated : 16 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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:

  • The float property is commonly used for creating multi-column layouts and positioning elements side by side.
  • Floated elements are taken out of the normal flow of the document.
  • Clearing floats is often necessary to prevent layout issues caused by floated elements.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads