我正试图让container-fluid
和第二row
伸展到剩余的高度,但我找不到办法。
我已尝试将align-items/align-self
设置为stretch
,但也无效。
以下是我的代码结构:
<div class="container-fluid"> <!-- I want this container to stretch to the height of the parent -->
<div class="row">
<div class="col">
<h5>Header</h5>
</div>
</div>
<div class="row"> <!-- I want this row height to filled the remaining height -->
<widgets [widgets]="widgets" class="hing"></widgets>
<div class="col portlet-container portlet-dropzone"> <!-- if row is not the right to stretch the remaining height, this column also fine -->
<template row-host></template>
</div>
</div>
</div>
我正在使用 Bootstrap 4 A6 。有人可以建议我如何使容器和行拉伸剩余的高度?
答案 0 :(得分:23)
Bootstrap 4.1.0有一个flex-grow
的实用程序类,它可以满足行填充剩余高度所需的内容。您可以添加自定义&#34; fill&#34;为此而上课。您还必须确保容器是全高的。
Bootstrap 4.1中的类名是flex-grow-1
html,body{
height:100%;
}
.flex-fill {
flex:1;
}
<div class="container-fluid d-flex h-100 flex-column">
<!-- I want this container to stretch to the height of the parent -->
<div class="row">
<div class="col">
<h5>Header</h5>
</div>
</div>
<div class="row bg-light flex-fill d-flex justify-content-start">
<!-- I want this row height to filled the remaining height -->
<div class="col portlet-container portlet-dropzone">
<!-- if row is not the right to stretch the remaining height, this column also fine -->
Content
</div>
</div>
</div>
https://www.codeply.com/go/kIivt8N1rn
相关:Bootstrap 4 make nested row fill parent that has been made to fill viewport height using flex-grow