【问题标题】:Material-ui makeStyles with both before and afterMaterial-ui makeStyles 前后都有
【发布时间】:2021-11-27 18:45:14
【问题描述】:

我正在做一个需要以下 CSS 代码的项目。

.hexagon, .hexagon::before, .hexagon::after {
  width: 67px;
  height: 116px;
  border-radius: 18%/5%;
}

有没有办法使用 Material-UI makeStyles 实现上述样式而不单独使用前后选择器?

【问题讨论】:

    标签: css reactjs material-ui jss makestyles


    【解决方案1】:

    您可以使用下面的代码,'&' 表示生成的类名,将传递给组件

    const useStyles = makeStyles({
      root: {
        "&, &:before, &:after": {
          // your styles
        }
      }
    });
    
    <div className={classes.root}>
    

    【讨论】:

      猜你喜欢
      • 2020-07-10
      • 1970-01-01
      • 1970-01-01
      • 2021-07-28
      • 2022-01-06
      • 1970-01-01
      • 2020-04-01
      • 2021-03-24
      • 2021-12-12
      相关资源
      最近更新 更多