Skip to content

Instantly share code, notes, and snippets.

@tomkeays
Created January 8, 2016 23:31
Show Gist options
  • Save tomkeays/98a2a711eb2608c1446c to your computer and use it in GitHub Desktop.
Save tomkeays/98a2a711eb2608c1446c to your computer and use it in GitHub Desktop.
JavaScript test to see if browser supports flexbox
// via Ethan Marcotte (10 December 2015)
// https://24ways.org/2015/putting-my-patterns-through-their-paces/
// If the browser passes the test, then a class of supports-flex gets applied to our html element.
var doc = document.body || document.documentElement;
var style = doc.style;
if ( style.webkitFlexWrap == '' ||
style.msFlexWrap == '' ||
style.flexWrap == '' ) {
doc.className += " supports-flex";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment