The CSS float
property is used to position an element in the webpage. It can push an element right, left or can
inherit the floating property of the parent element.
There is also clear
property which is used to specify the direction where other floating elments are not allowed.
Property | Description | Values |
---|---|---|
clear | left, right, none, inherit | It is used to avoid other floating elements which flow around it. |
float | left, right, both, none, inherit | It gives the floating direction to the element. |
Values | Description |
---|---|
none | It is the default position of the element i.e., the element displayed where it occurs in the text. |
right | It is used to float the element to the right. |
left | It is used to float the element to the left. |
initial | It sets the initial floating property of the element. |
inherit | It specifies that the parent element's floating property will be inherited. |
Mauris ante ligula, facilisis sed ornare eu, lobortis in odio. Praesent convallis urna a lacus interdum ut hendrerit risus congue. Nunc sagittis dictum nisi, sed ullamcorper ipsum dignissim ac. In at libero sed nunc venenatis imperdiet sed ornare turpis. Donec vitae dui eget tellus gravida venenatis. Integer fringilla congue eros non fermentum. Sed dapibus pulvinar nibh tempor porta. Cras ac leo purus. Mauris quis diam velit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum, nisi lorem egestas odio, vitae scelerisque enim ligula venenatis dolor. Maecenas nisl est, ultrices nec congue eget, auctor vitae massa. Fusce luctus vestibulum augue ut aliquet.
The clear
property specifies the sides where other floating elements are not allowed to float.
Float Left
Float Right
Follow Us: