以前遇到过类似的问题
[[CSS] flex布局+white-space: nowrap宽度异常](https://segmentfault.com/a/1190000044378248)
有如下flex布局
<div class="container">
<div class="left"></div>
<div class="right">
<div class="right-inner">
normal flex width (without "white-space: nowrap")
</div>
</div>
</div>
container的宽度设定为屏幕宽度的60%,container中分左右两个子div,left设定为container宽度的40%,right宽度设定为container的60%。
在right-inner中放置文字,如果此时用默认设定(不做什么其他操作),不论屏幕宽度如何变化,left, right两个div的宽度都正常。
但是一旦给right-inner加上white-space: nowrap属性后,在一旦宽度不够,right div的宽度就会被right-inner给撑开
屏幕较宽时的状态
屏幕较窄时的状态
此时解决问题的办法是给right div加上 min-width: 0; 这样宽度计算又恢复正常。
完结。
同步更新到自己的语雀
https://www.yuque.com/dirackeeko/blog/ge467hok2xgeb8so
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。