首页 > 解决方案 > 容器内的弹性尺寸项目

问题描述

我有一个容器,里面有 3 次潜水,里面有内容。

item1 = 50%
item2 = should shrink according to the left over space. 
item3 = 33% 

我试图让 item2 缩小到左边的空间。

I was using width = min-content on item2 but this doesn't work in IE11

所以我试图找到一种方法来完成这项工作。

.container {
  display: flex;
  justify-content: flex-start;
}

.item1 {
  width: 50%;
}

.item2 {
  width: auto;
}

.item3 {
  width: 33%;
}

我尝试使用 flex-shrink 但不完全了解这是否有助于 IE。如果 item3 不在容器中,那么 item2 应该占据另外 50%。

标签: cssflexbox

解决方案


推荐阅读