Flex๋ flex๋ฅผ ์ฌ์ฉํ ์์๋ค์๊ฒ ๋น์จ ํฌ๊ธฐ๋ฅผ ํ ๋นํด์ค๋๋ค.
<div style="display: flex">
<div style="flex: 1">flex(1)</div>
<div style="flex: 3">flex(3)</div>
<div style="flex: 2">flex(2)</div>
</div>
ํค๋๋ ์ด๋ ๊ฒ ์์ฑ๊ฐ๋ฅํฉ๋๋ค.
<div style="display: flex">
<div style="width: 200px">๋ก๊ณ </div>
<nav style="flex: 1">
<ul>
<li>๋ฉ๋ด1</li>
<li>๋ฉ๋ด2</li>
<li>๋ฉ๋ด3</li>
<li>๋ฉ๋ด4</li>
<li>๋ฉ๋ด5</li>
</ul>
</nav>
</div>
<ul style="display: flex; flex-direction: row">
<li style="flex: 1">๋ฉ๋ด1</li>
<li style="flex: 1">๋ฉ๋ด2</li>
<li style="flex: 1">๋ฉ๋ด3</li>
<li style="flex: 1">๋ฉ๋ด4</li>
<li style="flex: 1">๋ฉ๋ด5</li>
</ul>
์ฝํ
์ธ ๋ค์ ์ค์ ๊ธฐ์ค์ผ๋ก ๋ชจ์ ์ ์์ด์
<div style="display: flex; justify-content: center">
<button>Button1</button>
<button>Button2</button>
<button>Button3</button>
</div>
์ฝํ
์ธ ๋ค์ ์ค๋ฅธ์ชฝ ๊ธฐ์ค์ผ๋ก ๋ชจ์ ์ ์์ด์
<div style="display: flex; justify-content: flex-end">
<button>Button1</button>
<button>Button2</button>
<button>Button3</button>
</div>
์ฝํ
์ธ ๋ค์ ์ผ์ชฝ ๊ธฐ์ค์ผ๋ก ๋ชจ์ ์ ์์ด์
<div style="display: flex; justify-content: flex-start">
<button>Button1</button>
<button>Button2</button>
<button>Button3</button>
</div>
์ฝํ
์ธ ๋ค์ ๊ฐ์ ๋์ผํ ์ฌ๋ฐฑ์ผ๋ก ์ ๋ ฌํ ์ ์์ด์
<div style="display: flex; justify-content: space-around">
<button>Button1</button>
<button>Button2</button>
<button>Button3</button>
</div>
์ฝํ
์ธ ์๋์ ๋ถ์ด๊ณ , ๋จ์ ์ฌ๋ฐฑ์ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌํ ์ ์์ด์
<div style="display: flex; justify-content: space-between">
<button>Button1</button>
<button>Button2</button>
<button>Button3</button>
</div>
์ฝํ
์ธ ์ธ๋ก ์ ์ฒด๋ฅผ ์ฐจ์งํ ์ ์์ด์
<div style="display: flex; align-items: stretch; height: 200px;">
<button>Button1</button>
<button>Button2</button>
<button>Button3</button>
</div>
<header style="display: flex; max-width: 1000px">
<figure style="width: 150px">
<img
src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
style="width: 100%">
</figure>
<nav style="flex: 1">
<ul style="display: flex; justify-content: space-between">
<li><a href="">๋ฉ๋ด1</a></li>
<li><a href="">๋ฉ๋ด2</a></li>
<li><a href="">๋ฉ๋ด3</a></li>
<li><a href="">๋ฉ๋ด4</a></li>
<li><a href="">๋ฉ๋ด5</a></li>
</ul>
</nav>
</header>
.wrapper {display: flex; justify-content: center}
.list {width: 1140px; display: flex; justify-content: space-between}
.list__item {width: 150px; text-align: center}
<div class="wrapper">
<div class="list">
<figure class="list__item">
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" style="width: 100%">
<figcaption>์์ดํ
1</figcaption>
</figure>
<figure class="list__item">
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" style="width: 100%">
<figcaption>์์ดํ
2</figcaption>
</figure>
<figure class="list__item">
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" style="width: 100%">
<figcaption>์์ดํ
3</figcaption>
</figure>
<figure class="list__item">
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" style="width: 100%">
<figcaption>์์ดํ
4</figcaption>
</figure>
</div>
</div>