【发布时间】:2018-12-03 23:32:18
【问题描述】:
我正在使用样式化组件,并希望通过嵌套 css 为 div 内的子元素设置样式。看我的演示here
const styles = theme => ({
root: {
...theme.typography.button,
backgroundColor: theme.palette.common.white,
padding: theme.spacing.unit,
">span": {
background: "red"
}
}
});
function TypographyTheme(props) {
return (
<div className={props.classes.root}>
<h1>
<span>{"This div's text looks like that of a button."}</span>
</h1>
</div>
);
}
【问题讨论】: