The CSS float property is used to place an element on the left or right side of the parent container.

Syntax

float: left | right | none | inline-start | inline-end;

Values

leftThe element is placed on the left side of the parent block.
rightThe element is placed on the right side of the parent block.
inheritProperty of the parent element is inherited.
inline-start The element is placed on the start side of its containing block.
inline-end The element is placed on the end side of its containing block.
noneThe element is placed where it is specified in the code.

Example ā€“ float:left;

Output

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Example ā€“ float: right;

Output

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.