将图像与网格项材质 UI 中的中心对齐

gos*_*amp 3 css reactjs material-ui

我正在使用GridMaterial UI。我不知道为什么网格项目内的图像向左对齐而不是向中心对齐。

    <Grid container direction="row" justify="center" alignItems="center">
      <Grid item xs={6}>
        <Grid container direction="row" justify="center" alignItems="center" alignContent="center" style={{minHeight:"200px"}} >
            <Grid item xs={12}>
              <Typography style={{color:'white', textAlign:'center', fontSize:'2rem'}}>{name}</Typography>
            </Grid>
            <Grid item xs={6}>
              <a href={github} target="_blank">
                <img src={githubIcon} width="32px" height="32px" color="white"/>
              </a>
            </Grid>
        </Grid>
      </Grid>
    </Grid>

Run Code Online (Sandbox Code Playgroud)

同样在版式中,我必须使用它textAlign来居中,但如何对齐图像?

Tra*_*r69 7

尝试提供包装图像的网格、属性,然后通过向该容器添加和/或 来container使图像居中。justify="center"alignItems="center"