Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow (in contrast to absolute positioning).
A floating element is one where the computed value of float is not none.
As float implies the use of the block layout, it modifies the computed value of the display values, in some cases:
| inline | block |
| inline-block | block |
| inline-table | table |
| table-row | block |
| table-row-group | block |
| table-column | block |
| table-column-group | block |
| table-cell | block |
| table-caption | block |
| table-header-group | block |
| table-footer-group | block |
| inline-flex | flex |
| inline-grid | grid |
| other | unchanged |
Note: When accessing a CSS property in JavaScript through the HTMLElement.style object, single-word property names are used as is. Although float is a reserved keyword in JavaScript, the CSS float property is accessed as float in modern browsers. In older browsers, you must use cssFloat to access the float property. (This is similar to how the "class" attribute is accessed as "className" and the "for" attribute of a <label> element is accessed as "htmlFor".)
The float property is specified as a single keyword, chosen from the list of values below.
The element must float on the left side of its containing block.
rightThe element must float on the right side of its containing block.
noneThe element must not float.
inline-startThe element must float on the start side of its containing block. That is the left side with ltr scripts, and the right side with rtl scripts.
inline-endThe element must float on the end side of its containing block. That is the right side with ltr scripts, and the left side with rtl scripts.
| none |
| all elements, but has no effect if the value of display is none. |
| no |
| as specified |
| discrete |
As mentioned above, when an element is floated, it is taken out of the normal flow of the document (though still remaining part of it). It is shifted to the left, or right, until it touches the edge of its containing box, or another floated element.
In this example, there are three colored squares. Two are floated left, and one is floated right. Note that the second "left" square is placed to the right of the first. Additional squares would continue to stack to the right, until they filled the containing box, after which they would wrap to the next line.
A floated element is at least as tall as its tallest nested floated children. We gave the parent width: 100% and floated it to ensure it is tall enough to encompass its floated children, and to make sure it takes up the width of the parent so we don't have to clear its adjacent sibling.
Sometimes you may want to force an item to move below any floated elements. For instance, you may want paragraphs to remain adjacent to floats, but force headings to be on their own line. See clear for examples.
| Cascading Style Sheets Level 2 # propdef-float |
| CSS Logical Properties and Values Module Level 1 # float-clear |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Apr 20, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.