flex-direction
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 9ì.
flex-direction CSS ìì±ì íë ì¤ ì»¨í
ì´ë ë´ì ìì´í
ì ë°°ì¹í ë ì¬ì©í ì£¼ì¶ ë° ë°©í¥(ì ë°©í¥, ìë°©í¥)ì ì§ì í©ëë¤.
ìëí´ ë³´ê¸°
flex-direction: row;
flex-direction: row-reverse;
flex-direction: column;
flex-direction: column-reverse;
<section class="default-example" id="default-example">
<div class="transition-all" id="example-element">
<div>Item One</div>
<div>Item Two</div>
<div>Item Three</div>
</div>
</section>
#example-element {
border: 1px solid #c5c5c5;
width: 80%;
display: flex;
}
#example-element > div {
background-color: rgba(0, 0, 255, 0.2);
border: 3px solid blue;
width: 60px;
margin: 10px;
}
rowì row-reverseì ê²½ì° íë ì¤ ì»¨í
ì´ëì ë°©í¥ì±ì ìí¥ì ë°ìì ì°¸ê³ íì¸ì. 컨í
ì´ëì dir ê°ì´ ltrì´ë¼ë©´ rowë ì¼ìª½ë¶í° ììíë ê°ë¡ì¶ì, row-reverseë ì¤ë¥¸ìª½ë¶í° ììíë ê°ë¡ì¶ì ëíë
ëë¤. ê·¸ë¬ë dir ê°ì´ rtlì´ë¼ë©´ rowê° ì¤ë¥¸ìª½ë¶í° ììíë ê°ë¡ì¶ì, row-reverseê° ì¼ìª½ë¶í° ììíë ê°ë¡ì¶ì ëíë
ëë¤.
구문
/* í ì¤ì ê¸ì ìì±íë ë°©í¥ëë¡ */
flex-direction: row;
/* <row>ì²ë¼, ëì ìë°©í¥ */
flex-direction: row-reverse;
/* ê¸ ì¬ë¬ ì¤ì´ ìì´ë ë°©í¥ëë¡ */
flex-direction: column;
/* <column>ì²ë¼, ëì ìë°©í¥ */
flex-direction: column-reverse;
/* ì ì ê° */
flex-direction: inherit;
flex-direction: initial;
flex-direction: unset;
ê°
row-
íë ì¤ ì»¨í ì´ëì 주ì¶ì´ ê¸ì ìì± ë°©í¥ê³¼ ëì¼í©ëë¤. 주ì¶ì ììì ê³¼ ëì ì´ ì½í ì¸ ë°©í¥ê³¼ ëì¼í©ëë¤.
row-reverse-
rowì ëì¼íê² ëìíì§ë§ ììì ê³¼ ëì ì´ ë°ëì ìì¹í©ëë¤. column-
íë ì¤ ì»¨í ì´ëì 주ì¶ì´ ë¸ë¡ ì¶ê³¼ ëì¼í©ëë¤. 주ì¶ì ììì ê³¼ ëì ì´, ê¸ ìì± ëª¨ëì ì´ì ì§ì ë° ì´í ì§ì ê³¼ ëì¼í©ëë¤.
column-reverse-
columnê³¼ ëì¼íê² ëìíì§ë§ ììì ê³¼ ëì ì´ ë°ëì ìì¹í©ëë¤.
íì 구문
flex-direction =
row |
row-reverse |
column |
column-reverse
ìì
>HTML
<h4>This is a Column-Reverse</h4>
<div id="content">
<div class="box" style="background-color:red;">A</div>
<div class="box" style="background-color:lightblue;">B</div>
<div class="box" style="background-color:yellow;">C</div>
</div>
<h4>This is a Row-Reverse</h4>
<div id="content1">
<div class="box1" style="background-color:red;">A</div>
<div class="box1" style="background-color:lightblue;">B</div>
<div class="box1" style="background-color:yellow;">C</div>
</div>
CSS
#content {
width: 200px;
height: 200px;
border: 1px solid #c3c3c3;
display: -webkit-flex;
-webkit-flex-direction: column-reverse;
display: flex;
flex-direction: column-reverse;
}
.box {
width: 50px;
height: 50px;
}
#content1 {
width: 200px;
height: 200px;
border: 1px solid #c3c3c3;
display: -webkit-flex;
-webkit-flex-direction: row-reverse;
display: flex;
flex-direction: row-reverse;
}
.box1 {
width: 50px;
height: 50px;
}
ê²°ê³¼
ì ê·¼ì± ê³ ë ¤ì¬í
flex-direction ìì±ì row-reverse ëë column-reverse ê°ì ì¬ì©íë©´ DOM 구조ì ê·¸ ìê°ì ííì ì°¨ì´ê° ìê¹ëë¤. ì´ë ë®ì ìë ¥ì¼ë¡ ì¤í¬ë¦° 리ë ë± ì ê·¼ì± ê¸°ì ì ì¬ì©í´ ì´ëíë ì¬ì©ìì ê²½íì ë¶ì ì ì¸ ìí¥ì ì¤ ì ììµëë¤. ìê°ì (CSS) ììê° ì¤ìíë¤ê³ í´ë, ì¤í¬ë¦° 리ë ì¬ì©ìë ê·¸ ììê° ì´ë»ê² ëëì§ ì ì ììµëë¤.
ëª ì¸
| Specification |
|---|
| CSS Flexible Box Layout Module Level 1 > # flex-direction-property > |
| ì´ê¸°ê° | row |
|---|---|
| ì ì©ëì | flex containers |
| ìì | no |
| ê³ì° ê° | as specified |
| Animation type | discrete |
ë¸ë¼ì°ì í¸íì±
ê°ì´ 보기
- CSS íë ì¤ë°ì¤ ê°ì´ë: Basic Concepts of Flexbox
- CSS íë ì¤ë°ì¤ ê°ì´ë: Ordering flex items