Last active
April 4, 2018 12:17
-
-
Save nemzes/5773ffc35a15b5a1056f96c6e03781a5 to your computer and use it in GitHub Desktop.
Modernizr test for flexbox bug when using min-height
This file contains hidden or 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
// Modernizr test for flexbox bug when using min-height | |
// See https://connect.microsoft.com/IE/feedback/details/802625/min-height-and-flexbox-flex-direction-column-dont-work-together-in-ie-10-11-preview | |
// This will then fix it in IE: | |
// | |
// .container { | |
// display: flex; | |
// flex-direction: column; | |
// min-height: 100vh; | |
// } | |
// .flexboxbug .container { | |
// height: 100vh; | |
// } | |
var flexboxMinHeightCss; | |
flexboxMinHeightCss = '#modernizr{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;min-height:10px;color:blue;} '; | |
flexboxMinHeightCss += '#modernizr :first-child{-webkit-flex:1;flex:1;color:red;}'; | |
Modernizr.testStyles(flexboxMinHeightCss, function(elem, rule) { | |
Modernizr.addTest('flexboxbug', elem.firstElementChild.offsetHeight !== 10); | |
}, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment