css自适应高度或宽度,超出内容显示滚动条
css自适应高度或宽度,超出内容显示滚动条:有时候项目中使用了flex布局,高度或是宽度是自动填满剩余空间,不是具体的数值的时候,想要设置区域滚动条
·
场景
有时候项目中使用了flex布局,高度或是宽度是自动填满剩余空间,不是具体的数值的时候,想要设置区域滚动条,可采用以下方法设置:
解决方法:
<div style="flex: 1;width: 30%;">
<div style="position: relative;height: 100%;width: 100%;">
<div style=" display: flex;flex-direction: column;height: 100%;">
<div style="flex-grow: 1;height:0">
<div style="overflow: auto;height: 100%;overflow-x: hidden;">
自定内容
</div>
</div>
</div>
</div>
</div>
效果
更多推荐
已为社区贡献1条内容
所有评论(0)