Created
August 23, 2013 21:20
-
-
Save shshaw/6324153 to your computer and use it in GitHub Desktop.
Modernizr tests for Absolute Centering ( http://codepen.io/shshaw/pen/gEiDt )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Will Absolute Centering work in this browser? | |
Modernizr.testStyles('#modernizr { height: 50px; width: 50px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; }', function(elem, rule) { | |
Modernizr.addTest('absolutecenter', Math.round(window.innerHeight / 2 - 25) === elem.offsetTop); | |
}); | |
// Does this browser support Display: Table variable height? | |
Modernizr.testStyles('#modernizr { display: table; height: 50px; width: 50px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; }', function(elem, rule) { | |
Modernizr.addTest('absolutecentercontent', Math.round(window.innerHeight / 2 - 25) === elem.offsetTop); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment