在全高布局中集成flexbox和垂直滚动
使用新的FlexBox properties 试图将全新的FlexBox属性应用于全高和可滚动的设计引入限制。使用高度的解决方法:0px; on a wrapper element is unreliable and creates additional issues.
Solution: Setting Height for Vertical Scrolling Element
A robust solution involves setting a specific height for the element where vertical scrolling is desired.这允许Flexbox算法计算适当的高度并根据需要渲染滚动条。例如,使用以下CSS:#容器文章{ 弹性:1 1自动; 溢出Y:自动; 身高:0px; }
确定最小高度如果需要最小高度,请替换高度:0px;带有最高的高度:期望的价值; to ensure the element displays a scrollbar even when its content does not exceed the specified minimum.
Final Example
In summary, the most effective solution to combine flexbox and vertical scrolling in a full-height layout is to set a height (or min-height) for the vertically scrollable element.这允许最佳的渲染和滚动栏行为,从而带来无缝的用户体验。免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3