float
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. |
inside |
Applies to book layout. The element flows to the right side of a left page and to the left side of a right page. |
outside |
Applies to book layout. The element flows to the left side of a left page and to the right side of a right page. |
page |
The element flow is determined by the page area, which is the flow root for the element. |
multicol |
The element flow is determined by the element that includes a float: multicol property. |
intrude |
The element may intrude into neighboring columns. |
unless-room |
The element layout will ignore the float property unless it causes a page break. |
top |
The element is floated to the top of the flow root. |
bottom |
The element is floated to the bottom of the flow root. |
next |
The element is floated to the top of the next page. |
page(p) |
The element is floated to the page designated by p, which is created by the page(p) property, specifically for the purpose of displaying the element. |
hide |
The element is not displayed (as though display: none were set. |
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:
<img src="sphere.jpg" style="float:left">
<img src="cone.jpg" style="float:right">
Standards information
This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) .
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
Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.