align-items, align-self not working on IE11

后端 未结 1 1140
天命终不由人
天命终不由人 2020-12-16 19:40

I have a simple plunker here.

.container {
  display:flex;
  flex-flow: row nowrap;
  justify-content: space-between;
  align-items: center;
  min-height: 4         


        
相关标签:
1条回答
  • 2020-12-16 20:20

    This is a bug in IE11.

    The min-height property on a flex container isn't recognized by flex items in IE11.

    If you switch to height: 4em, you'll see that your layout works.

    A simple workaround is to make .container a flex item.

    In other words, add this to your code:

    body {
        display: flex;
    }
    
    .container {
        width: 100%; /* or flex: 1 */
    }
    

    For whatever reason, by making your flex container also a flex item, the min-height rule is respected by the child elements.

    More details here: Flexbugs: min-height on a flex container won't apply to its flex items

    0 讨论(0)
提交回复
热议问题