CSS float property
Examples
Let the image float to the right:
img
{
float:right;
}
{
float:right;
}
try it"
In the bottom of this page for more examples.
Attribute definitions and instructions
float property specifies a box (element) whether it should float.
Note: absolutely positioned elements ignored float property!
Defaults: | none |
---|---|
inherit: | no |
version: | CSS1 |
JavaScript syntax: | object .style.cssFloat = "left" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
float | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Property Value
value | description |
---|---|
left | Elements float left. |
right | Right-floating elements. |
none | Defaults. Elements do not float, and will appear in the position in which they appear in the text. |
inherit | Provisions should inherit the float property value from the parent element. |
More examples
The first letter of a paragraph float to the left
So that the first letter of a paragraph float to the left, and add the letter style.
Create a horizontal menu
Floating menu to create a horizontal list of hyperlinks.
Create a table-free home
Floating to create own header, footer, left pane and the main content of the page.
related articles
CSS tutorial: CSS the Float