Little Web Hut

CSS 2.1 Reference: float Property

CSS float Property
Syntax
selector {float: value;}
  • value is specified by using one of the following keywords: left, right, none, or inherit.
Usage

The float property is used to float an element's box to the left or the right. If a box is floated, then the content (text, images, etc.) that follows will wrap around the box. The float property does not apply to absolutely positioned elements.

This property is specified by using a keyword according to the syntax shown above.


CSS Example: The float properties are set using a left and a right floating image.
  #tst1 {float: left;}
  #tst2 {float: right;}
Test It HTML StyleTest It XHTML StyleTest It HTML5 Style

Keywords
  • left - The element's box is floated to the left.
  • right - The element's box is floated to the right.
  • none - The element's box is not floated.
  • inherit - The inherit keyword is used to specify that the value for this property should be taken from the parent element. If inherit is used with the root element, then the initial value for this property will be used.
Applies To All elements
Inherited No
Initial Value none


float Property Examples
Test It HTML StyleTest It HTML StyleTest It HTML5 StyleThe float properties are set using a left and a right floating image.