【发布时间】:2021-03-03 13:31:06
【问题描述】:
我正在使用一个通过 Vue CLI 使用 Vue 3、Vue Router 和 Bootstrap 构建的演示 Web 应用程序。不幸的是,我无法让我的网页填满浏览器窗口的整个高度。
我尝试使用引导程序在最高级别的 div 上设置 vh-100,但它似乎仍然垂直匹配内容的最小高度,而不是消耗整个可见视口高度。
如何让我的应用布局遵循 Bootstrap 的 vh-100 属性?
App.vue
<template>
<router-view/>
</template>
<script>
export default {
name: "App"
}
</script>
LoginPage.vue
<template>
<div class="vh-100 container" id="app">
<div class="row vh-25">
<div class="image-container row justify-content-center align-items-center">
<img src="../assets/images/pic.png" alt="picture">
</div>
</div>
<div class="row vh-75">
<EmailForm/>
</div>
</div>
</template>
<script>
import EmailForm from '@/components/EmailForm.vue'; // @ is an alias to /src
export default {
components: {
EmailForm,
}
}
</script>
<style>
.container {
margin: 0;
background: url(~@/assets/images/background_pic.jpg) repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.image-container {
position: relative;
left: 0;
right: 0;
top: 0;
bottom: 0;
text-align: center;
}
img {
padding: 0;
display: block;
margin: 0 auto;
max-height: 60%;
max-width: 60%;
}
</style>
【问题讨论】:
-
您使用的是 bootstrap 4.1 或更高版本吗?
-
是的,我使用的是 bootstrap 4.5.3
标签: css vue.js bootstrap-4 vue-router vuejs3