flex 子元素的宽度好像会被 PRE 元素撑开。
例如: codepen,如何让c2的宽度不被撑开?
增加下面这个就好了
white-space: pre-wrap; word-wrap: break-word; word-break:break-all;
.c2 {overflow: hidden}
想要不被撑开,那就要限制.main一个width/height.c2-child 设置其不能滚动,设置width/height
.main{ display:flex; flex-wrap: nowrap; width: 100px; height: 200px; } .c1{ flex:0 0; background-color:yellow; } .c2{ flex:1 1; background-color:red; } .c2-child{ background-color:green; width: 100%; height: 100%; overflow: hidden; }
设置子元素的width和height,
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(4)
增加下面这个就好了
想要不被撑开,那就要限制.main一个width/height
.c2-child 设置其不能滚动,设置width/height
设置子元素的width和height,