On this page
float
Prev: `gap` | Up: layout | Next: box_model
Rel: display (flex/grid), layout, Display & Layout Guide
Ref: MDN Web Docs — float
Tags: #public #web #css #properties #layout #tier/legacy
Syntax & Overview
float: left | right | none;
Pulls an element out of normal flow so inline text wraps around it.
Legacy / Avoid: Prefer display (flex/grid) for modern layouts.
- Initial:
none| Inherited: No | Animatable: No
Notes & Best Practices
- Legacy for page layout: Never use
floatfor grids or navbars—reserve it strictly for wrapping editorial text around an image/callout, and usedisplay: flow-rooton the parent to contain floats.
Example
.article { display: flow-root; }
.article img.pull { float: inline-start; margin-inline-end: 1rem; max-width: 12rem; }
Linked from
Related notes
- tuts/css/properties/layout/gap Linked here; links to this page; shared tags: #css, #layout, #properties, #tier, #web
- tuts/css/properties/layout Linked here; links to this page; shared tags: #css, #layout, #properties, #web
- tuts/css/properties/layout/display Linked here; shared tags: #css, #layout, #properties, #tier, #web
- tuts/css/properties/display_and_layout Linked here; shared tags: #css, #layout, #properties, #web
- tuts/css/properties/box_model Linked here; shared tags: #css, #properties, #web
- tuts/css/properties/layout/align-items shared tags: #css, #layout, #properties, #tier, #web
- tuts/css/properties/layout/flex shared tags: #css, #layout, #properties, #tier, #web
- tuts/css/properties/layout/grid-template-columns shared tags: #css, #layout, #properties, #tier, #web
- tuts/css/properties/layout/justify-content shared tags: #css, #layout, #properties, #tier, #web
- tuts/css/properties/box_model/aspect-ratio shared tags: #css, #properties, #tier, #web