刚开始使用vue组件写网页时,经常会出现添加的背景图片不显示,或者只显示一部分。
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<style scoped>
.about{
background-image: url(../img/bg.jpg);
background-size: 100% 100%;
height: 100%;
position: fixed;
width: 100%;
}
</style>
但是经常会出现这种缝。
很简单只需要添加两行代码。
.about{
background-image: url(../img/bg.jpg);
background-size: 100% 100%;
height: 100%;
position: fixed;
bottom: 0;
right: 0;
width: 100%;
}