Bootstrap 4 应用程序的Bootstrap 4 Flex布局
如何使用Bootstrap 4创建此布局。在Flexbox推出4之前,我自己做过一次,但现在我想使用Bootstrap4Bootstrap 4 应用程序的Bootstrap 4 Flex布局,bootstrap-4,Bootstrap 4,如何使用Bootstrap 4创建此布局。在Flexbox推出4之前,我自己做过一次,但现在我想使用Bootstrap4 <div class="d-flex flex-column"> <div>Fixed Header Height</div> <div>This should take full available height of screen</div> <div>Fixed Footer Heigh
<div class="d-flex flex-column">
<div>Fixed Header Height</div>
<div>This should take full available height of screen</div>
<div>Fixed Footer Height</div>
</div>
我应该在中间分区上使用什么类使其占据整个屏幕的高度?您需要编写一些css,例如将flex div的最小高度应用于100vh,然后将flex:1应用于中间分区 …据我所知,bootstrap4中没有这样的类可以将flex:1和height:screen height设置为div 堆栈片段 navbar先生{ 背景:ccc; } .d-flex.flex-column{ 高度:100vh; } .全高{ 背景:黑色; 弹性:1; 颜色:fff; } 固定收割台高度 这应该是屏幕的全部可用高度 固定页脚高度
您需要编写一些css,比如将flex div的最小高度应用于100vh,然后将flex:1应用于中间div …据我所知,bootstrap4中没有这样的类可以将flex:1和height:screen height设置为div 堆栈片段 navbar先生{ 背景:ccc; } .d-flex.flex-column{ 高度:100vh; } .全高{ 背景:黑色; 弹性:1; 颜色:fff; } 固定收割台高度 这应该是屏幕的全部可用高度 固定页脚高度
看起来您想要创建顶部的固定页眉、底部的固定页脚和用作内容的剩余空间。这可以通过使用引导非常容易地实现。以下是布局示例:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Resources -->
<style type='text/css'>
.header {
height: 60px;
}
.footer {
height: 80px;
}
.app-content {
margin-top: 60px;
margin-bottom: 80px;
}
</style>
</head>
<body class="vertical-layout">
<div class="fixed-top header bg-success">
<!-- Content -->
</div>
<div class="content app-content">
<!-- Content -->
</div>
<footer class="footer footer-dark fixed-bottom bg-info">
<!-- Content -->
</footer>
</body>
</html>
看起来您想要创建顶部的固定页眉、底部的固定页脚和用作内容的剩余空间。这可以通过使用引导非常容易地实现。以下是布局示例:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Resources -->
<style type='text/css'>
.header {
height: 60px;
}
.footer {
height: 80px;
}
.app-content {
margin-top: 60px;
margin-bottom: 80px;
}
</style>
</head>
<body class="vertical-layout">
<div class="fixed-top header bg-success">
<!-- Content -->
</div>
<div class="content app-content">
<!-- Content -->
</div>
<footer class="footer footer-dark fixed-bottom bg-info">
<!-- Content -->
</footer>
</body>
</html>
这看起来是可行的,但页眉和页脚实际上位于中间的顶部。下面的答案正确无误。@GregGum请看……页眉和页脚的高度不是固定的……它们的高度将由内部内容计算出来……因此我认为在中间的顶部和底部留有固定的边距是行不通的……我更新了我的答案,但没有使用固定的位置这似乎是可行的,但是页眉和页脚实际上在中间的顶部。下面的答案是正确的。@GregGum请看……页眉和页脚的高度不是固定的……它们的高度将由内部内容计算出来……所以我认为在顶部和底部中间留出固定的边距是不可行的……我更新了我的答案,但没有使用固定位置
<div class="d-flex flex-column full">
<div>Fixed Header Height</div>
<div class="fill">
This should take full available height of screen
</div>
<div>Fixed Footer Height</div>
</div>