LoginSignup
0
0

More than 3 years have passed since last update.

単純な横並びのレイアウトはgridがおすすめ

Last updated at Posted at 2020-04-12

flexだと横並びにしたコンテンツ間のマージン設定がしづらい。

gridだと下記のような書き方で簡単に設定できる。
.クラス名{
display: grid;
align-items: center;
grid-template-columns: 1fr 1fr;
gap: 24px;
}

gapプロパティを設定することでアイテム同士の横方向と縦方向の間隔をまとめて指定できる点がflexとの違いの一つ。

以上です。 お読みいただきありがとうございます。

0
0
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
0
0