由于vue组件中四周总会出现白空隙,而在vue中又没有像html中对body样式的修改,因此,需要通过一个最外的div来解决。
<template>
<div class="bg">
</div>
</template>
<style>
.bg{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: auto;
background-color: red;
}
</style>
【css/vue】Vue组件中对body操作样式的一种解决方案
阅读 96
2023-01-07
由于vue组件中四周总会出现白空隙,而在vue中又没有像html中对body样式的修改,因此,需要通过一个最外的div来解决。
<template>
<div class="bg">
</div>
</template>
<style>
.bg{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: auto;
background-color: red;
}
</style>
相关推荐
精彩评论(0)