CSS
Float

Float is used to align an element to the left or right side of its container.

It is similar to text-align but the main difference between them is that Align does not remove the item from the document flow whereas float removes it.

Property Values

The possible values are as follows:

ValuesDescription
rightIt aligns the element along the right side.
leftDefault value. It aligns the element along the left side.
inheritIt inherits the alignment of the parent.

Float Example

Below example will demonstrate the basic architecture of CSS Float

Float text to right
Float text to left
Float text as inherit
Example:
                    

<!doctype html>  
<html>
    <head>
        <title>...</title>
    </head>
  
    <body>
       <p style="float: right;">Learn CSS from PHPDocs.</p>
    </body>
</html>