Sets on which side of the object the text will flow.

Syntax

{ float: sFloat }

Possible values

sFloat

String that specifies or receives one of the following values:

none

Default. Object is displayed where it appears in the text.

left

Text flows to the right of the object.

right

Text flows to the left of the object.

This property has a default value of none. It is not inherited.

Remarks

With a value of left or right, the object is treated as block-level—that is, the display property is ignored. For example, floating paragraphs allow the paragraphs to appear side by side on a page.

Objects following a floating object move relative to the position of the floating object.

The floating object is moved left or right until it reaches the border, padding, or margin of another block-level object.

DIV and SPAN objects must have a width set for the float property to render.

Examples

This example shows how the float property affects the flow of the text. The sphere image floats to the left of the text, and the cone floats to the right:

 Copy Code
<img src="sphere.jpg" style="float:left">
<img src="cone.jpg" style="float:right">

Standards information

Applies to

A, ADDRESS, APPLET, B, BIG, BLOCKQUOTE, BUTTON, CENTER, CITE, CODE, CUSTOM, DD, DEFAULTS, DFN, DIV, DL, DT, EM, EMBED, FIELDSET, FORM, HN, HR, I, IFRAME, IMG, INPUT TYPE=BUTTON, INPUT TYPE=CHECKBOX, INPUT TYPE=FILE, INPUT TYPE=IMAGE, INPUT TYPE=PASSWORD, INPUT TYPE=RADIO, INPUT TYPE=RESET, INPUT TYPE=SUBMIT, INPUT TYPE=TEXT, LI, OBJECT, OL, P, RT, RUBY, S, SELECT, SPAN, SUB, TABLE, TT, U, UL, VAR, XMP

See also

Concepts