Skip to content

Instantly share code, notes, and snippets.

@pfulton
Created December 10, 2012 21:17
Show Gist options
  • Save pfulton/4253505 to your computer and use it in GitHub Desktop.
Save pfulton/4253505 to your computer and use it in GitHub Desktop.
CSS box-sizing detection with Modernizr
// test whether or not CSS box-sizing is supported. Append the relevant classes to the html element.
// for reference: http://www.snackoclock.net/2012/08/simple-box-sizing-border-box-fallback-for-ie/
Modernizr.addTest("boxsizing", function() {
return Modernizr.testAllProps("boxSizing") && (document.documentMode === undefined || document.documentMode > 7);
});
if(!Modernizr.boxsizing){
alert("No box-sizing, but we added a class for you!");
}
// alternatively, provide some kind of fall-back
Modernizr.load([{ test : Modernizr.boxsizing , nope : 'box-sizing-fallback.js' }]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment