CSS Float
Float is a CSS property written in CSS file or directly in the style of an element. The float property defines the flow of content. Below are the types of floating properties:
| Float type | Usage |
|---|---|
| float: left | Element foats on left side of the container |
| float: right | Element floats on right side of container |
| float: inherit | Element inherits floating property of it’s parent (div, table etc…) |
| float: none | Element is displayed as it is (Default). |
float:left
<!DOCTYPE html> <html> <head> <title>Float</title> </head> <body> <div class = "GFG" style = "font-size:40px; color:#006400; float:left;"> GeeksforGeeks </div> </body> </html> |
chevron_right
filter_none
Output:
float:right
<!DOCTYPE html> <html> <head> <title>Float</title> </head> <body> <div class = "GFG" style = "font-size:40px; color:#006400; float:right;"> GeeksforGeeks </div> </body> </html> |
chevron_right
filter_none
Output:
folat:none
<!DOCTYPE html> <html> <head> <title>Float</title> </head> <body> <div class = "GFG" style = "font-size:40px; color:#006400; float:none;"> GeeksforGeeks </div> </body> </html> |
chevron_right
filter_none
float:inherit
<!DOCTYPE html> <html> <head> <title>Float</title> </head> <body> <div style="float:right"> <div class = "GFG" style = "font-size:40px; color:#006400; float:inherit;"> GeeksforGeeks </div> </div> </body> </html> |
chevron_right
filter_none
Output:
Recommended Posts:
- p5.js | float() function
- Comparing float value in PHP
- How to convert string into float in JavaScript?
- How to make elements float to center?
- Bootstrap | Float utilities with Examples
- How to float three div side by side using CSS?
- How to disable tabs in Bootstrap ?
- Page Object Model (POM)
- Difference between background and background-color
- How to get card vertically centered between search bar and bottom of the viewport?
- What is the difference between parseInt() and Number()?
- How to display bootstrap carousel with three post in each slide?
- HTML | <iframe> name Attribute
- HTML | <map> name Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.






