Floating Property in CSS
Floating
With CSS float, an element can be pushed to the left or right, allowing other elements to wrap around it. Mostly float is used with images, but it is also used when working with layouts. The values for the float property are left, right, and none. Left and right float elements in those directions, respectively. none (the default) ensures that the element will not float. However, elements cannot float up or down. It can only be moved horizontally. If we place several elements together, they will float next to each other.
Syntax:-
Its syntax is:-
< style >
element{
float: none| left| right| initial| inherit;
}
< /style >
Further Explanation:-
Value | Description |
---|---|
none | The element does not float. |
left | The element floats to the left of its container |
right | The element floats to the right of its container |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |