The CSS float
property specifies how an element should float.
The CSS clear
property specifies what elements can float beside the cleared element and on which side.
The float property is utilized to position and format content, such as allowing an image to be aligned to the left of text within a container.
The float property can be assigned one of the following values:
At its simplest, the float property allows text to wrap around images.
In the following example, an image is set to float to the right within a text.
Example
img { float: right; } |
Example
img { |
Example
img { float: none; } |
div { float: left; padding: 15px; } .div1 { background: red; } .div2 { background: yellow; } .div3 { background: green; } |