CSS Layout - Floating and Clearing
- Previous Page CSS Overflow
- Next Page CSS Clear Floats
CSS Layout - Floating and Clearing
CSS float
The property specifies how elements float.
CSS clear
The property specifies which elements can float next to the cleared elements and on which side.
float property
float
The property is used to position and format content, such as making the image float to the left of the text in the container.
float
The property can be set to one of the following values:
- left - The element floats to the left side of its container
- right - The element floats to the right side of its container
- none - The element does not float (it will be displayed at the position where it appears in the text). Default value.
- inherit - The element inherits its parent's float value
The simplest usage is,float
The property can realize the effect of (newspapers) text wrapping around the image.
Instance - float: right;
The following example specifies that the image should float to the right in the text:

Leading Web Technology Tutorials - All Free. At CodeW3C.com, you can find all the website construction tutorials you need, from basic HTML to CSS, to advanced XML, SQL, JS, PHP, and more.
Our reference manual covers all aspects of website technology. It includes W3C standard technologies such as HTML, CSS, XML, and other technologies such as JavaScript, PHP, SQL, etc.
At CodeW3C.com, we provide thousands of examples. By using our online editor, you can edit these examples and experiment with the code.
Example
img { float: right; {}
Instance - float: left;
The following example specifies that the image should be in the textLeftFloat:

Leading Web Technology Tutorials - All Free. At CodeW3C.com, you can find all the website construction tutorials you need, from basic HTML to CSS, to advanced XML, SQL, JS, PHP, and more.
Our reference manual covers all aspects of website technology. It includes W3C standard technologies such as HTML, CSS, XML, and other technologies such as JavaScript, PHP, SQL, etc.
At CodeW3C.com, we provide thousands of examples. By using our online editor, you can edit these examples and experiment with the code.
Example
img { float: left; {}
Instance - No float
In the following example, the image will be displayed at the position where it appears in the text (float: none;):
Leading Web Technology Tutorials - All Free. At CodeW3C.com, you can find all the website construction tutorials you need, from basic HTML to CSS, to advanced XML, SQL, JS, PHP, and more.
Our reference manual covers all aspects of website technology. It includes W3C standard technologies such as HTML, CSS, XML, and other technologies such as JavaScript, PHP, SQL, etc.
At CodeW3C.com, we provide thousands of examples. By using our online editor, you can edit these examples and experiment with the code.
Example
img { float: none; {}
Further Reading
Supplementary Books:CSS Floating
- Previous Page CSS Overflow
- Next Page CSS Clear Floats