我想为<p>
当前组件中的所有人添加规则。我在任何地方都找不到有关如何按标签名称添加 CSS 规则的信息(material-ui 文档、Stack Overflow 等)。
不支持吗?
我正在尝试做这样的事情:
const useStyles = makeStyles((theme: Theme) =>
createStyles({
'p': {
margin: 0,
},
someClass: {
fontSize: 14,
},
})
);
Run Code Online (Sandbox Code Playgroud)
编辑:
使用 Ryan 的解决方案有效,但会产生一个新问题:
import React from 'react';
import { makeStyles, Theme, createStyles } from '@material-ui/core';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
'& p': {
margin: 0,
},
},
// I want this rule to override the rule above. It's not possible in the current configuration, because `.root …
Run Code Online (Sandbox Code Playgroud)