css - Material UI - 全球主题的多个 css 类
问题描述
我第一次使用带有 React 的 Material UI。我想改变我的全局主题,但我想改变的有两个类:
.MuiListItem-root.Mui-selected, .MuiListItem-root.Mui-selected:hover {
background-color: rgba(0, 0, 0, 0.08);
}
我如何选择它们createMuiTheme
?我试过这个:
createMuiTheme({
overrides: {
MuiListItem: {
root: {
Mui: {
selected: {
backgroundColor: "black",
"&:hover": {
backgroundColor: "blue",
},
},
},
},
},
}
})
先感谢您
解决方案
试试这段代码
createMuiTheme({
overrides: {
MuiListItem: {
root: {
'&$selected': {
backgroundColor: "black"
},
'&$selected:hover'{
backgroundColor: "blue"
}
},
},
},
})
看看这个回应
推荐阅读
- c# - srings 操作:正则表达式替换为 \T
- google-bigquery - 数据流 - 将 avro 对象存储到未知的 GCS 文件夹
- laravel - laravel:显示下拉列表中的数据
- java - 如何在 Eclipse 插件上动态或更新名称?
- javascript - Chrome 自动下载 PDF
- sql - 如何在简单的三向关系上实现基于约束的参照完整性
- acumatica - 如何自定义 InventoryID 选择器?
- azure - 使用 Virtual Kubelet 从 AKS 突发到 ACI 时无法访问 Azure 容器注册表存储库
- c - 二元炸弹第 4 阶段确认
- git - 在 Git 中覆盖整个项目