CSS float property
Let the image float to the right:
{
float:right;
}
Try it out . . .
There are more examples at the bottom of this page.
Description of property definition and use
The float property specifies whether a box (element) should float.
Note: Absolutely positioned elements ignore the florat property!
Default: | none |
---|---|
Inherited: | no |
Version: | CSS1 |
JavaScript syntax: | object .style.cssFloat="left" |
Browser support
The numbers in the table support the first browser version number of the property.
Attributes | |||||
---|---|---|---|---|---|
float | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
The property value
Value | Describe |
---|---|
left | The element floats to the left. |
right | The element floats to the right. |
none | The default. Elements do not float and appear where they appear in the text. |
inherit | Specifies that the value of the float property should be inherited from the parent element. |
More instances
The first letter of the paragraph floats to the left
Float the first letter of a paragraph to the left and style it.
Create a horizontal menu
Use floats to create a list of hyperlinks to horizontal menus.
Create a tableless home page
Use floating to create a home page with header, footer, left directory, and body content.
Related articles
CSS tutorial: CSS Float