문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
wiki:css:css_note:css_flex_items [2021/07/16 08:49] emblim98 만듦 |
wiki:css:css_note:css_flex_items [2023/01/13 18:44] (현재) |
||
---|---|---|---|
줄 16: | 줄 16: | ||
flex container의 직계 자식 요소들은 자동으로 flexible (flex) items가 됩니다.\\ | flex container의 직계 자식 요소들은 자동으로 flexible (flex) items가 됩니다.\\ | ||
\\ | \\ | ||
- | {{: | + | {{: |
- | 위의 요소는 그레이 컬러의 flex container 내부의 4개의 블루 컬러의 flex items를 나타냅니다.\\ | + | \\ |
+ | 위의 요소는 그레이 컬러의 flex container 내부에 4개의 블루 컬러의 flex items를 나타냅니다.\\ | ||
<code css> | <code css> | ||
+ | < | ||
+ | .flex-container { | ||
+ | display: flex; | ||
+ | background-color: | ||
+ | } | ||
+ | .flex-container > div { | ||
+ | background-color: | ||
+ | color: #fff; | ||
+ | width: 100px; | ||
+ | margin: 10px; | ||
+ | text-align: center; | ||
+ | line-height: | ||
+ | font-size: 30px; | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
+ | \\ | ||
+ | flex item 속성들은 하기와 같습니다. | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | ===== The order Property ===== | ||
+ | '' | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | 코드 상의 첫 번째 flex item은 레이아웃에서 첫 번째 아이템으로 나타날 필요는 없습니다.\\ | ||
+ | order값은 숫자이어야 하고, 기본 값은 0 입니다.\\ | ||
+ | ==== Example ==== | ||
+ | /order/ 속성은 flex items의 순서를 변경할 수 있습니다. | ||
+ | <code css> | ||
+ | < | ||
+ | .flex-container { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | background-color: | ||
+ | } | ||
+ | .flex-container> | ||
+ | background-color: | ||
+ | color: white; | ||
+ | width: 100px; | ||
+ | margin: 10px; | ||
+ | text-align: center; | ||
+ | line-height: | ||
+ | font-size: 30px; | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | <div style=" | ||
+ | <div style=" | ||
+ | <div style=" | ||
+ | <div style=" | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== The flex-grow Property ===== | ||
+ | '' | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | 값은 숫자이어야 하며, 기본 값은 0입니다.\\ | ||
+ | |||
+ | <code css> | ||
+ | < | ||
+ | .flex-container { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | background-color: | ||
+ | } | ||
+ | |||
+ | .flex-container> | ||
+ | background-color: | ||
+ | color: white; | ||
+ | margin: 10px; | ||
+ | /* 박스의 너비가 지정되지 않았습니다. */ | ||
+ | text-align: center; | ||
+ | line-height: | ||
+ | font-size: 30px; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | <div style=" | ||
+ | <div style=" | ||
+ | <div style=" | ||
+ | <!-- 3번 박스는 브라우저 창의 너비와 상관없이 항상 1번, 2번 박스에 비해 8배 너비를 유지합니다. --> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== The flex-shrink Property ===== | ||
+ | '' | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | 값은 숫자이어야 하며, 기본 값은 1 입니다.\\ | ||
+ | |||
+ | ==== Example ==== | ||
+ | 세 번째 flex item이 나머지 다른 flex items만큼 축소되지 않게 하는 예제입니다\\ | ||
+ | <code css> | ||
+ | < | ||
+ | .flex-container { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | background-color: | ||
+ | } | ||
+ | |||
+ | .flex-container> | ||
+ | background-color: | ||
+ | color: white; | ||
+ | width: 100px; | ||
+ | margin: 10px; | ||
+ | text-align: center; | ||
+ | line-height: | ||
+ | font-size: 30px; | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | <p>Do not let the third flex item shrink as much as the other flex items:</ | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | < | ||
+ | <div style=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== The flex-basis Property ===== | ||
+ | '' | ||
+ | \\ | ||
+ | {{: | ||
+ | |||
+ | ==== Example ==== | ||
+ | 세 번째 flex item의 초기 길이 값을 200px로 설정합니다.\\ | ||
+ | |||
+ | <code css> | ||
+ | < | ||
+ | .flex-container { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | background-color: | ||
+ | } | ||
+ | |||
+ | .flex-container> | ||
+ | background-color: | ||
+ | color: #fff; | ||
+ | width: 100px; | ||
+ | margin: 10px; | ||
+ | text-align: center; | ||
+ | line-height: | ||
+ | font-size: 30px; | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | < | ||
+ | <div style=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== The flex Property ===== | ||
+ | '' | ||
+ | \\ | ||
+ | ==== Example ==== | ||
+ | 하기 예제는 세 번째 flex item이 확장되지도, | ||
+ | <code css> | ||
+ | < | ||
+ | .flex-container { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | background-color: | ||
+ | } | ||
+ | |||
+ | .flex-container> | ||
+ | background-color: | ||
+ | color: #fff; | ||
+ | width: 100px; | ||
+ | margin: 10px; | ||
+ | text-align: center; | ||
+ | line-height: | ||
+ | font-size: 30px; | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | <p> | ||
+ | Make the third flex item not growable (0), not shrinkable (0), and with an initial length 0f 200 pixels: | ||
+ | </p> | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | < | ||
+ | <div style=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== The align-self Property ===== | ||
+ | '' | ||
+ | \\ | ||
+ | '' | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | 아래의 2개 예제에서는 200픽셀 높이의 플렉스 컨테이너를 사용하여 '' | ||
+ | \\ | ||
+ | ==== Example ==== | ||
+ | 컨테이너의 중간에 있는 세 번째 플렉스 아이템을 정렬합니다.\\ | ||
+ | <code css> | ||
+ | < | ||
+ | .flex-container { | ||
+ | display: flex; | ||
+ | height: 200px; | ||
+ | background-color: | ||
+ | } | ||
+ | |||
+ | .flex-container> | ||
+ | background-color: | ||
+ | color: #fff; | ||
+ | width: 100px; | ||
+ | margin: 10px; | ||
+ | text-align: center; | ||
+ | line-height: | ||
+ | font-size: 30px; | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | < | ||
+ | <div style=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== Example ==== | ||
+ | 컨테이너의 상단에 두 번째 플레스 아이템을 정렬하고, | ||
+ | \\ | ||
+ | {{: | ||
+ | <code css> | ||
+ | < | ||
+ | .flex-container { | ||
+ | display: flex; | ||
+ | height: 200px; | ||
+ | background-color: | ||
+ | } | ||
+ | |||
+ | .flex-container> | ||
+ | background-color: | ||
+ | color: #fff; | ||
+ | width: 100px; | ||
+ | margin: 10px; | ||
+ | text-align: center; | ||
+ | line-height: | ||
+ | font-size: 30px; | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | <div style=" | ||
+ | <div style=" | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | ===== The CSS Flexbox Items Properties ===== | ||
+ | 다음 표에는 모든 %%CSS Flexbox%% 항목 속성이 나열되어 있습니다.\\ | ||
+ | |||
+ | ^ Property | ||
+ | | align-self | ||
+ | | flex | flex-grow, flex-shrink 및 flex-basis 속성에 대한 약식 속성 | ||
+ | | flex-basis | ||
+ | | flex-grow | ||
+ | | flex-shrink | ||
+ | | order | 동일한 컨테이너 내부에서 플렉스 아이템들의 순서를 지정합니다. | ||