防止Flexbox缩小 [英] Prevent flexbox shrinking
本文介绍了防止Flexbox缩小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用flexbox来布局页面,因为 growing 行为很有用.但我想完全防止收缩行为.
I'm using flexbox to layout a page because the growing behavior is useful. But I'd like to completely prevent the shrinking behavior.
任何人都可以管理吗?
示例代码:
<div class="flex-vertical-container">
<div class="flex-box">
This one should grow but not shrink
</div>
<div></div>
<div></div>
</div>
CSS
.flex-vertical-container {
display: flex;
flex-direction: column;
}
.flex-box {
flex: 1;
}
推荐答案
尝试在.flex-box
上将flex-shrink
属性设置为0
.
Try setting the flex-shrink
property to 0
on the .flex-box
.
这篇关于防止Flexbox缩小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文