CSS FLOAT

rainbow baker

 CSS FLOAT

  • The CSS float property specifies how an element should float.
  • A floated element may be moved as far to the left or the right as possible. Simply, it means that a floated element can display at extreme left or extreme right.
  • The elements after the floating element will flow around it.
  • The elements before the floating element will not be affected.

There are four types of css float property:
  • left - The element floats to the left of its container.
  • right - The element floats to the right of its container
  • none - The element does not float (will be displayed just where it occurs in the text). This is default
  • Inherit - The element inherits the float value of its parent.

EXAMPLE

<!DOCTYPE html>
<html>
<head>
<style>
div {
  float: left;
  padding: 15px; 
}
</style>
</head>
<body>
<h2>Float Next To Each Other</h2>
<p>In this example, the three divs will float next to each other.</p>
</body>
</html>

OUTPUT

Float Next To Each Other
In this example, the three divs will float next to each other.





Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send