LoginSignup
0
1

More than 3 years have passed since last update.

よくあるヘッダーレイアウト ~FlexBox~

Posted at

image.png

FlexBoxを使うとWEBデザインでよくあるレイアウトを簡単にコーディングすることができます。

<div class="flex">
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
</div>
.flex {
  display: flex;
  justify-content: flex-end;
}
.flex > :first-child {
  margin-right: auto;
}

これだけ

justify-content: flex-end はflexアイテムを全て右に寄せる設定です。

この際、Flexアイテムに「margin-right: auto;」の記述を組み合わせると、設定したアイテムの右側に自動的に余白を作ることができます。

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