css - react material-ui 如何覆盖 muibox-root

标签 css reactjs material-ui overriding react-material

我想覆盖整个应用程序的 MuiBox-root 样式。根据 official documentation我需要确定类(class):

enter image description here

除其他事项外,我可以覆盖它:

enter image description here

但如果我继续这样做,它只会删除样式。我在这里做错了什么?

最佳答案

这样做会:

import { withStyles } from "@material-ui/core/styles";

const styles = {
  root: {
    padding: "10px"
  }
};

function App({ classes }) {
  return <yourelement  className={classes.root}>xyz...<yourelement/>;
}
export default withStyles(styles)(App);

关于css - react material-ui 如何覆盖 muibox-root,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65224386/

相关文章:

javascript - 使用 useState() 共享组件状态以实现导航中的事件链接

javascript - 从 React MaterialUI RadioButtonGroup 获取值和 id

jquery - 如何检测滚动高度并使用 jQuery 相应地更改标题

jquery - 删除 css 类的特定属性的问题

javascript - React JS 如何使用 session 存储在页面之间传递值

javascript - 无论有或没有连接,操作都不会通过 Redux-Form 进行调度

html - 嵌套网格中的最后一列总是在新行中

html - <img> 元素并显示 :table-cell

reactjs - 可分配给 'P' 类型的约束,但 'P' 可以用约束 'TextInputProps' 的不同子类型实例化

javascript - 如何在 MUI DataGrid 上启用列大小调整