html - Flexbox renders differently in different broswers -


i coded flexbox in google chrome (version 44.0.2403.157) , code works intended. there 1 column height of 100%, column has 2 rows: header , content. header has height defined content, content row has height determined height of browser minus height of head row. when tested code in safari (version 8.0.2 (10600.2.5)), displayed 1 row , 2 columns. tried adding "width: 100%: row, force there 1 column did not work. causing discrepancy , how fix it?

<html> <head> <style> .box { display: -webkit-flex; display: -webkit-box; /* old - ios 6-, safari 3.1-6 */ display: -moz-box;    /* old - firefox 19- (buggy works) */ display: -ms-flexbox;  /* tweener - ie 10 */ display: -webkit-flex; /* new - chrome */ display: flex;         /* new, spec - opera 12.1, firefox 20+ */   flex-flow: column;   height: 100%;   width: 100%;   border: 2px solid; }   .box .row {   flex: 0 1 30px;     border: 2px solid;     width: 100%; }  .box .row.header { -webkit-flex: auto;   flex: 0 1 auto; }  .box .row.content {   flex: 1 1 auto;     overflow: scroll; }  </style> </head> <body> <div id="page-wrapper" style="height: 100%"> <div class="box"> <div class="row header"> header - height of header based on content </div> <!-- end of flex row header --> <div class="row content"> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br> content - height of content row total broswer height minus header height <br> <br> <br>  </div> <!-- end of flex row content --> </div> <!-- end of flex box --> </div> <!-- end of page wrapper --> </body> </html> 

safari (not how want look)

enter image description here

chrome (how want look)

enter image description here

take of http://caniuse.com/#feat=flexbox

you need set these on container:

display: -ms-flexbox;  /* ie 10 */ display: -webkit-flex; /* safari 8 */ display: flex;         /* modern browsers */ 

and:

-ms-flex-direction: column; -webkit-flex-direction: column; flex-direction: column; 

for child elements:

-ms-flex: 0 1 auto; -webkit-flex: 0 1 auto; flex: 0 1 auto; 

etc.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -