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 used for positioning and formatting content, for example, letting an image float beside text in a container.
The float
property can have one of the following values:
The following example shows how an image floats to the right of some text:
Normally, div elements are stacked vertically. But with float: left
, we can make them sit side by side.