What is float property in CSS?

The CSS float property states how the element should float. For example, it can specify the position where the element should be placed.

Note: The element can be anything i.e., an image, a paragraph, a button, etc.

Syntax

The syntax for the float CSS property is:

float: value;

CSS float property can have the following values:

  • None: There will be no effect on the position of the element i.e., the element will not float.

  • Right: The element floats to the right of its container

  • Left: The element floats to the left of its container

  • Inherit: The element inherits the float value of its parent

Float: None

The following example displays the image when the float is set to none:

Float: Right

The following example makes the image float to the right of the container:

Float: Left

The following example makes the image float to the left of the container:

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved