property

float — CSS reference

Moves a box to an edge so neighboring line content can wrap around it. Initial none; not inherited. A float is blockified; logical inline-start/end adapt to direction. In-flow flex/grid items are not floated by this property. Use flex/grid for general component layout rather than float hacks.

Formal Syntax & Structure

css syntaxcss
none | left | right | inline-start | inline-end

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS flow layout lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}body{font:16px/20px sans-serif} #p{width:240px;background:#e6eef2} .tile{background:#c2e4d5} #a,#b{box-sizing:content-box}#a{float:left;width:80px;height:60px;background:#72b7a5}</style><body><div id="p"><div class="tile" id="a"></div><span id="b">Text</span></div></body></html>
CSS Reference