html - Difference between height 100% in FireFox and everyone else -
i'm trying make several nested containers stretch fill page. know there ton's of questions , answers out there , every 1 has different answer none explain why behavior exists.
basically @ arbitrary point "height:100%" stops functioning , have switch on "min-height:100%" , if happen have both present layout massively screwed up.
i have solution works in ie11, ff(latest), , chrome(latest) , 1 works in others doesn't work in ff , can't tell why.
here jsfiddle explaining it, but i'd note jsfiddles display behavior doesn't match browsers @ all i'm going try , write out code. https://jsfiddle.net/2xa8rvek/
basically here's happens. place big block of content in center not scroll when window large enough scroll when window height reduced. observe different behavior based on color shown.
i call senario a when scrollbar shown , window scrolled half way down. call senario b when page height large enough bottom of text block shown.
document
<html> <body> <div id="content-container"> <div id="page-specific-container"> <div class="content-middle"> arbitrary amount of content goes here force screen re-size if user wasn't full screen. </div> </div> </div> </body> </html>
css
* { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } body, html{ margin: 0; padding: 0; font-size: 16pt; width: 100%; height: 100%; background: blue; } #content-container{ padding-top: 45px; /* navigation */ height: 100%; background: red; } #page-specific-container{ /* @ point "height" property alone no longer works scrolling */ /* firefox requires "height: 100%" present or else .content-middle tag doesn't work */ min-height: 100%; background: yellow; } .content-middle{ /* if "height:" referenced here @ break layout */ min-height: 100%; background:purple; }
here's rundown of behavior:
-- height: 100% #page-specific-container , .content-middle
------- scenario show blue strip @ bottom.
------- scenario b show purple way down.
-- min-height: 100% #page-specific-container , .content-middle
------- scenario shows purple in browsers.
------- scenario b shows yellow in ff shows purple in other browsers.
-- min-height: 100% , height: 100% #page-specific-container , min-height:100%; .content-middle
------- scenario show purple way down.
------- scenario b show purple way down.
-- min-height: 100% , height: 100% both #page-specific-container , .content-middle
------- scenario show blue color.
------- scenario b show purple only.
why ff behave differently? why there random depth height: 100% no longer works?
edit: note format of layout breaks flexbox inside #page-specific-container
Comments
Post a Comment