Flex 自适应剩余宽度?-灵析社区

应该是最帅的鹅

.container { display: flex; gap: 1rem; padding: 1rem; background-color: red; color: white; } .box { background-color: blue; padding: 1rem; } .fx{ width: 300px; } Fill Fixed Fixed Fixed ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241011/a8e8d92bf3225b5bc5ebfd7efd02057a.png) 1. `Fixed` 盒子数量不是固定的 2. `Fixed` 盒子宽度是固定的 3. `Fill` 盒子只有一个 4. `Fill` 盒子宽度是动态的 **如何让 Fill 填满剩余 Container 的宽度? 如下图** ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241011/3cf489dcbc62786205c42cd10565e81a.png)

阅读量:182

点赞量:0

问AI
北北che
.fill { flex: auto; }