1. 程式人生 > >VUE2.0學習筆記(三):如何設定當前頁面的背景色

VUE2.0學習筆記(三):如何設定當前頁面的背景色

程式碼如下:

<template>

    <div>

    //div裡面的程式碼省略了.div代表下圖中灰色的容器

    <div>

</template>

<style scoped>

div{

    width: 100%;

    height: 100%;

    background-color: #f5f5f5;

}

</scoped>

出來的效果如下,但我需要的是把整個頁面的背景色改為灰色。


方法是:

給div的增加一條樣式(紅色部分)就可以了~

div{

    width: 100%;

    height: 100%;

    background-color: #f5f5f5;

    position: fixed;

}

效果圖如下: