codegurukool.com · Free coding tutorials & online compiler

Home › CSS Tutorial › CSS float

CSS float

Wrap text around an element.

Float is mainly for images inside text. Use clear to stop wrapping. Use flexbox or grid for page layout.

Example code

<style>.f{float:left;width:70px;height:70px;background:gold;margin:0 10px 6px 0}</style>
<div class='f'></div><p>Text wraps around the floated box. Text wraps around the floated box. Text wraps around the floated box.</p>

Run this code in the online editor

← CSS overflowCSS inline-block →