Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flex-grow in IE11 doesn't vertically stretch

I thought that IE 11 had full support for flexbox properties but I get a different behavior than on Chrome/Firefox

I simplified it to this simple example: I'm trying to have a 100% height div with a flex child inside that also grows to 100% height. It works in chrome and Firefox but on IE the flex child doesn't grow in height...

Fiddle: https://jsfiddle.net/7qgbkj0o/

body, html {
  background-color: red;
  min-height: 100%;
  height: 100%;
  padding: 0;
  margin:0;
}
.p{
  display: flex;
  min-height: 100%;
}

.c1 {
  flex-grow: 1;
  background-color: gray;
}
<div class="p">
<div class="c1">
  asdasd
</div>
</div>

On IE11: http://imgur.com/a/eNKIJ

On Chrome: http://imgur.com/a/xYmJW

I know there are probably alternatives to achieve this without using flexbox but in my real world case I really need to use flexbox here so what's wrong and how can I achieve this on IE11 using flexbox?

like image 978
AlfaTeK Avatar asked Sep 21 '16 07:09

AlfaTeK


People also ask

Does Flexbox work in ie11?

Note also that Internet Explorer 11 supports the modern display: flex specification however it has a number of bugs in the implementation.

How does CSS flex grow work?

flex-grow and flex-basis Just a quick recap: flex-grow will take the remaining space and divide it by the total amount of flex grow values. The resulting quotient is multiplied by the respective flex-grow value and the result is added to each child elements initial width.


1 Answers

Seems IE11 has an issue with only having min-height.

Try adding a base height.

.p{
  display: flex;
  min-height:100%;
  height: 100%;
}

body,
html {
  background-color: red;
  min-height: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}
.p {
  display: flex;
  min-height: 100%;
  height: 100%;
}
.c1 {
  flex: 1;
  background-color: gray;
}
<div class="p">
  <div class="c1">
    asdasd
  </div>
</div>
like image 143
Paulie_D Avatar answered Oct 16 '22 08:10

Paulie_D