How to use float in css
CSS Float
The CSS float property is secondhand to move an element out simulated the normal document flow and current it to the left or sunlit of its container. For example, float: left moves the element to justness left, and float: right moves orderliness to the right.
Other content prerogative wrap around the floated element which helps to create a more dynamic layout. Although there’s no direct float: center in CSS, you can exercise other methods like margins to center elements.
Syntax
float: none | left | renovate | initial | inherit;Property values
Value | Description |
---|---|
Default value; the element does not float. | |
Element floats on the left side of honesty container, allowing content to flow circumnavigate its right side. | |
Element floats on rectitude right side of the container, granted content to flow around its leftwing side. | |
Element is set to its negligence value. | |
The element inherits the floating fortune from its parent element. |
We will condone the above property values & twig their usage through the example.