我如何在React材质UI卡“ MuiCardContent-root:last-child”默认填充底部中删除填充底部?

时间:2019-11-21 06:21:39

标签: reactjs material-ui

这是我的代码

https://stackblitz.com/edit/react-me9rk9

attached screenshot for your reference

return (
    <Card className={classes.card} >
      <CardContent>
        <Grid container justify="space-between">

          <Grid item container spacing={0}  alignItems="center" justify="left">
            <Grid container direction="row"  alignItems="flex-start">

              <AssessmentOutline  color="primary"  className={classes.largeIcon} />

            <Grid >
            <Typography color="textPrimary" gutterBottom variant="h1">20</Typography>
            <Typography color="textPrimary" gutterBottom variant="h6">Assessment Due</Typography>
          </Grid>            
            </Grid>                  
      </Grid>
        </Grid>
      </CardContent>
    </Card>
  );

2 个答案:

答案 0 :(得分:0)

在CSS下方添加

.MuiCardContent-root:last-child {
   padding-bottom : 0 !important;
}

答案 1 :(得分:0)

import { withStyles } from "@material-ui/core";
const styles = (theme) => ({
    removeBottomPadding: {
        paddingBottom: "0px"
    }
});

class YourComponetName extends Component {
    render(){
         const { classes } = this.props;
         return (
            <MaterialComponent classes={{ root: classes.removeBottomPadding}}>
                 // your code 
            </MaterialComponent >
        )
    }

}
export default withStyles(styles, { withTheme: true })(YourComponentName)