JaneDoe1337 JaneDoe1337 - 2 months ago 7x
CSS Question

How compatible is float:none?

I am a little confused about the compatibility and useage of Float:none;.
Basicaly I am using float:left in my general stylesheet and want to create an exception to this using a media query. In this query I want to 'undo' the float left.

My first thought was to use 'Float:none;' however I seem to find very little documentation on how this should be used and if it's compatible with all browsers.

I checked 'caniuse.com' and it gave me two different answers to the same question... When I search for 'float' it says it's barely supported. And when I search for 'Float:none;' it says it's widely supported.

Should I be using float:none for this cause and/or is there a better way to 'undo' a float?


float: none; should be fine to "undo" a floating environment. As an alternative, you can also set clear: both; on an element, that ends the floating environment.

Or in your case: clear: left;

In general, float (with all its properties) is widely supported by browsers. Make sure you looked at the CSS property when checking "caniuse":

CSS 2.1 properties (well-supported subset): float (none | left | right)