【发布时间】:2020-03-29 18:27:40
【问题描述】:
我一直坚持这一点,坦率地说,我什至不知道如何谷歌它,我所有的谷歌努力都是徒劳的。我的 HTML 如下:
<div class="uk-flex uk-flex-column uk-height-1-1">
<!-- normal div with height 100vh and flexbox of flex column -->
<div>div that will have height fit contents</div>
<div class="uk-flex-1">
<!-- div that will fill the remaining space -->
<div class="uk-height-1-1">div that should fill the height of the parent</div>
</div>
<div>div that will have height fit content</div>
</div>
现在我的主要问题是让孙子 div (.uk-height-1-1) 让它的高度填充父级,我如何让它的高度填充父级 div 的高度??
注意:以下问题的链接是我以前经历过的,他们没有回答我的问题
Fill remaining vertical space with CSS using display:flex
Make a div fill the height of the remaining screen space
更新:我使用uikit,我最初发布问题的方式是为了简化问题,uk-height-1-1 = height: 100%
【问题讨论】:
-
你能用你的css更新吗?您是否尝试将 class="viewport-height flex-column" 设置为 flex-direction 列?而你只是希望 flex-1 是全高的?
-
@ShrewdStyle 我发布了之前的问题只是为了简化,但我已经更新了它,看看,如果您需要更多说明,请告诉我
-
不要重复问题