css

[css] Flexbox ์‚ฌ์šฉ <ul><li></li></ul> ๋„ค๋ชจ๋ฐ•์Šค ์„ธ๋กœ์ •๋ ฌ

natrue 2021. 11. 19. 13:39
728x90

* display: flex; align-content: flex-start; flex-direction: column; flex-wrap: wrap 

flex-wrap

flex-wrap property๋Š” flex-item ์š”์†Œ๋“ค์ด ๊ฐ•์ œ๋กœ ํ•œ์ค„์— ๋ฐฐ์น˜๋˜๊ฒŒ ํ•  ๊ฒƒ์ธ์ง€, ๋˜๋Š” ๊ฐ€๋Šฅํ•œ ์˜์—ญ ๋‚ด์—์„œ ๋ฒ—์–ด๋‚˜์ง€ ์•Š๊ณ  ์—ฌ๋Ÿฌํ–‰์œผ๋กœ ๋‚˜๋ˆ„์–ด ํ‘œํ˜„ ํ•  ๊ฒƒ์ธ์ง€ ๊ฒฐ์ •ํ•˜๋Š” ์†์„ฑ์ด๋‹ค. ๋งŒ์•ฝ ์˜์—ญ ๋‚ด์—์„œ ๋ฒ—์–ด๋‚˜์ง€ ๋ชปํ•˜๊ฒŒ ์„ค์ •ํ•œ๋‹ค๋ฉด, ๋™์‹œ์— ์š”์†Œ์˜ ๋ฐฉํ–ฅ ์ถ•์„ ๊ฒฐ์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

ul : ๋ถ€๋ชจ ์—˜๋ฆฌ๋จผํŠธ - display: flex๋ฅผ ์„ค์ • ํ•œ ๋ถ€๋ชจ ์—˜๋ฆฌ๋จผํŠธ

 li : ์ž์‹ ์—˜๋ฆฌ๋จผํŠธ - Flex container ๋‚ด์˜ ์ž์‹ ์—˜๋ฆฌ๋จผํŠธ

.divUl{display: flex; align-content: flex-start; flex-direction: column; flex-wrap: wrap}
.divUl li{border: 1px solid gold; list-style: none; margin-bottom:10px; padding: 30px;color: red; background-color: #fff8b6;}
<ul class="divUl">
  <li></li>
  <li></li>
  <li></li>
</ul>