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
left | The element is placed on the left side of the parent block. |
right | The element is placed on the right side of the parent block. |
inherit | Property 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. |
none | The 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.