Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Modernizr tests for Absolute Centering ( http://codepen.io/shshaw/pen/gEiDt )

View Modernizr.AbsoluteCenter.js
1 2 3 4 5 6 7 8
// 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
Something went wrong with that request. Please try again.