25
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

material-UI Grid itemの中央寄せ

Last updated at Posted at 2019-08-13

##解決策

//grid の親コンポーネント
<Grid container alignItems="center" justify="center">
  <Grid item xs={8}>
    <Tweet />
  </Grid>   
</Grid>

alignItemsとjustifyを指定すればそれだけで中央寄せが可能でした。

##冗長なやり方
今までこんな風にめちゃめちゃ冗長にやってたなぁ...

//grid の親コンポーネント
<Grid container alignItems="center" justify="center">
  <Grid item xs={0} md={2}></Grid>
  <Grid item xs={12} md={8}>
    <Tweet />
  </Grid>
  <Grid item xs={0} md={2}></Grid>
</Grid>
25
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?