代码如下:

<template>

    <div>

    //div里面的代码省略了.div代表下图中灰色的容器

    <div>

</template>

<style scoped>

div{

    width: 100%;

    height: 100%;

    background-color: #f5f5f5;

}

</scoped>

出来的效果如下,但我需要的是把整个页面的背景色改为灰色。

VUE2.0学习笔记(三):如何设置当前页面的背景色

方法是:

给div的增加一条样式(红色部分)就可以了~

div{

    width: 100%;

    height: 100%;

    background-color: #f5f5f5;

    position: fixed;

}

效果图如下:

VUE2.0学习笔记(三):如何设置当前页面的背景色



相关文章:

  • 2021-12-21
  • 2022-02-23
  • 2021-10-31
  • 2021-11-17
  • 2021-07-02
  • 2021-12-22
  • 2021-08-11
  • 2021-12-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 1970-01-01
  • 2023-03-31
  • 2021-08-15
  • 2022-01-08
  • 2022-01-03
相关资源
相似解决方案