简体   繁体   English

CssBaseline 覆盖主题背景颜色 MUI? 反应器

[英]CssBaseline Overriding theme background colour MUI? Reactjs

I am using material ui to make a theme which works fine but when I add <CssBaseline/> to the App.js it turns the background colour white even though I put in the index.css that the background colour should be #1f262a.我正在使用材料 ui 制作一个可以正常工作的主题,但是当我将<CssBaseline/>添加到 App.js 时,它会将背景颜色变为白色,即使我在 index.css 中输入了背景颜色应该是 #1f262a。 I tried adding:我尝试添加:


  overrides: {
    CssBaseline: {
      "@global": {
        body: {
          backgroundColor: "#1f262a",
        }
      }
    }
  },

To the theme but it did not make a difference.到了主题,但它并没有什么不同。 I appreciate any responses.我感谢任何回应。

you should use MuiCssBaseline instead CssBaseline:你应该使用 MuiCssBaseline 而不是 CssBaseline:

  overrides: {
    MuiCssBaseline: {
      "@global": {
        body: {
          backgroundColor: "#1f262a",
        }
      }
    }
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM