vue给单独页面添加背景颜色

vue 单独设置背景颜色的方法是在template下的子div上添加样式

<template>
    <div></div>
</template>

给style添加一个scoped表示当前样式只给当前页面设置。
将这个div属性设为:fixed,

例如:

<style scoped>
    .htmlBox{
        position: fixed;
        width: 100%;
        height: 100%;
        top: 0px;
        background-color: #ffffff;
    }
</style>

即可改变当前页面的背景颜色

猜你喜欢

转载自blog.csdn.net/Shuanger112/article/details/81870916