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.



Article ID: 1072
Created: Fri, Jun 3, 2022
Last Updated: Fri, Jun 3, 2022
Author: Administrator

Online URL: https://www.articlediary.com/article/what-is-the-purpose-of-float-property-in-css-1072.html