CSS floatProperty


Example

Float the image to the right:

img
{
float:right;
}

Try it Yourself »

More examples at the bottom of this page.

Attribute definition and usage instructions

The float property specifies whether a box (element) should float.

Note:Absolutely positioned elements ignore the float property!

Default value: none
Inherited: no
version: CSS1
JavaScript Syntax: object.style.cssFloat="left"


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
float 1.0 4.0 1.0 1.0 7.0

Property value

Value Description
left The element floats to the left.
right The element floats to the right.
none Default value. The element does not float, and will be displayed in its position in the text.
inherit Specifies that the value of the float property should be inherited from the parent element.


Examples

More Examples

The first letter of the paragraph floats to the left.
Float the first letter of a paragraph to the left, and add style to this letter.

Create a horizontal menu
Use float to create a horizontal menu of hyperlink lists.

Create a Tableless Homepage
Use float to create a homepage with a header, footer, left-hand table of contents, and main content area.


Related Articles

CSS Tutorial:CSS Float

other extensions