Style cssFloat Property
The Style object
Definition and Usage
The cssFloat property sets or returns the horizontal alignment of an element.
Syntax
Set the cssFloat property:
Object.style.cssFloat="left|right|none|inherit"
Return the cssFloat property:
Object.style.cssFloat
| Value | Description |
|---|---|
| left | The object/element floats to the left of the parent element. |
| right | The object/element floats to the right of the parent element. |
| none | Default. The object/element does not float. |
| inherit | The value of the cssFloat property is inherited from the parent element. |
Browser support





All major browsers support the cssFloat property.
**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".
Tips and Notes
**Note:** If there is too little space in a line for a floating element, the element will jump to the next line, and this process continues until there is a line with enough space.
Example
Example
Click two buttons to set an image to float to the left or right side of the text:
This is a paragraph.
This is also a paragraph.
Try it »
The Style object