๋ฐ์ํ
flex-basis๊ฐ ํญ์ width์ ์ ์ฉ๋๋ ๊ฒ์ ์๋๋ค.
flex-direction: row์ธ ๊ฒฝ์ฐ, flex-basis ๋ ๋๋น๋ฅผ ์ ์ดํ๋ค.
๊ทธ๋ฌ๋ flex-direction: column์ธ ๊ฒฝ์ฐ, flex-basis๋ ๋์ด๋ฅผ ์ ์ดํ๋ค.
- ์ฃผ์์ฐจ์ด์
- flex-basis๋ flex item๋ง ์ ์ฉ๋๋ค. flex container ๋ flex-basis ๋ฅผ ๋ฌด์ํ์ง๋ง width๋ height๋ ์ฌ์ฉํ ์ ์๋ค.
- flex-basis๋ ์ฃผ์ถ์์ ์๋ํ๋ค. ์๋ฅผ ๋ค์ด flex-direction: column์ ํ๋ ์ค ํญ๋ชฉ์ ํฌ๊ธฐ๋ฅผ ๊ฐ๋ก๋ก ์กฐ์ ํ๋ ค๋ฉด width ์์ฑ์ด ํ์ํ๋ค.
- ์ ๋์์น์ ์๋ flex ํญ๋ชฉ์๋ ์ํฅ์ ์ฃผ์ง ์๋๋ค.
#container {
display: flex;
flex-direction: column;
max-width: 800px;
margin: auto;
background-color: #fff;
}
.item {
flex-basis: 50px;
font-size: 40px;
}
#container {
display: flex;
flex-direction: column;
max-width: 800px;
margin: auto;
background-color: #fff;
}
.item {
width: 50px;
font-size: 40px;
}
Reference
๋ฐ์ํ
'๐ฉ๐ปโ๐ปSTUDY > CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CSS] counter : css๋ก ์๋ฒ๋ํ๋ด๊ธฐ (0) | 2022.04.18 |
---|---|
[CSS] flex ์์ฑ (flex-basis, flex-grow, flex-shrink) (0) | 2021.12.27 |
[CSS] ์นํฐํธ ์ฐธ๊ณ (0) | 2021.10.26 |
[CSS] CSS ์ ํ์ ์ฐ์ ์์ (0) | 2021.10.13 |
[CSS] flex ๋ฐ์ํ์ ๋ฐ๋ผ ๋ฐ์ค ๋จ์ด๋จ๋ฆฌ๊ธฐ (0) | 2021.09.27 |