CSS float Property

CSS float property specifies the how element should float to the left, right, or not at all.

Usages

The following table outline the usages and version history of this property.

Default value: none
Applies to: All elements
Inherited: No
Version: CSS1
JavaScript Syntax: object.style.cssFloat = "right"

Syntax

Here is a syntax for the CSS float property

float: none | left | right | initial | inherit;

Property Values

The following table describes the values of this property.

Value Description
none Default. The element does not float
left The element is float on the left side of its containing block
right The element is float on the right side of its containing block
initial Sets default value of this property
inherit Inherits this property from its parent element

Examples

The example below shows to sets float property.

div.one {
  float: left;
}
div.two {
  float: right;
}
div.three {
  float: none;
  width: 40px;
}

Run it...   »

Browser Compatibility

  • Google Chrome 1+
  • Mozilla Firefox 1+
  • Internet Explorer 5+
  • Opera 6+
  • Safari 1+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.