简体   繁体   中英

flex-basis: auto doesn't work in IE11

I have 3 divs with different width that I want to shrink to container using flexbox.

Made a fiddle: https://jsfiddle.net/easyNick/1m8ude39/14/

CSS looks like this:

.child {
 order: 0;
 flex-grow: 0;
 flex-shrink: 1;
 flex-basis: auto;
 min-height: auto;
 min-width: auto;
 align-self: auto;
 position: relative;
 display: block;
 padding: 0 0.25rem;
}

Works great in Chrome ets.

在此处输入图片说明

But IE 11 sees flex-basis as width and last div doesn't even fit to container:

.child {
 order: 0;
 flex-grow: 0;
 flex-shrink: 1;
 width: auto;
 min-height: auto;
 min-width: auto;
 align-self: auto;
 position: relative;
 display: block;
 padding: 0 0.25rem;
}

在此处输入图片说明

I've found some advices to set flex-basis to some percentage number. But 100% doesn't make what I need.

在此处输入图片说明

Setting particular values makes layout not flexible.

Any ideas of what may help?

Flex-basis wont work on the IE11 .

But you can target flex-basis property using this CSS rule. Try this one

_:-ms-fullscreen, :root .IE-FlexAuto {
  flex-basis: auto;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM