float

Floats

Example

float pushes an element to one side and lets text wrap around it. Today it is mainly used for images in articles; use Flexbox or Grid for layouts:

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <style>
    img { float: left; margin: 0 12px 6px 0; }
    p { font-family: Arial; line-height: 1.5; }
    .clear { clear: both; background: #f1f1f1; }
  </style>
</head>
<body>

<img src="https://picsum.photos/id/1080/100/80" alt="Strawberries" width="100" height="80">
<p>The image floats to the left and this text wraps around it on the right side. Floats were once used to build whole page layouts, but Flexbox and Grid do that job far better now.</p>
<p class="clear">clear: both starts below the float.</p>

</body>
</html>

Result