Nested flexbox adds empty space on IE10 and 11

风格不统一 提交于 2019-12-10 09:17:16

问题


I'm using flexbox for a layout. My constraint is that the image must be situated at the middle.

I've made a minimal markup that reproduces the issue: http://codepen.io/anon/pen/xwNomN

It works perfectly well in all browsers EXCEPT on IE 10 and 11, where (as shown in the CodePen) a big amount of empty space is added at the top and bottom of the image.

.collection__list {
  display: flex;
  flex-wrap: wrap;
}

.product-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-item__figure {
  position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 0 auto;
}

.product-item__figure > a {
  display: flex;
    position: relative;
    flex: 1;
}

.product-item__image-wrapper {
    position: relative;
    width: 100%;
}

.product-item__image {
      display: block;
    margin: 0 auto;
  max-width: 100%;
}

I've tried a lot of fixes, played with flex-shrink, flex-grow... but after 1 whole day lost, I'd love to know what I'm doing wrong.

Thanks


回答1:


Oh... I've found it by chance. Adding overflow: hidden to product-item__figure made the trick....



来源:https://stackoverflow.com/questions/33915243/nested-flexbox-adds-empty-space-on-ie10-and-11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!