What is the purpose of float property in CSS?

The float property is used for positioning the HTML elements horizontally either towards the left or right of the container. For instance,

float-demo {
     float: right; 

Here, the element to which the class is applied ensures that the element is positioned on the right of the container. If you specify the value of float as left, then the element will be placed on the left side of the container.