카테고리 없음

[css] flex property

냐옴 2021. 5. 18. 11:13
{
    flex: /* */
}

HTML

<p>.container1</p>
<div class="container container1">
    <div class="box box1">.box1</div>
    <div class="box box2">.box2</div>
    <div class="box box3">.box3</div>
</div>

<p>.container2</p>
<div class="container container2">
    <div class="box box1">.box1</div>
    <div class="box box2">.box2</div>
    <div class="box box3">.box3</div>
</div>

CSS

.container {
    border: 1px solid gray;
    padding: 10px;
    height: 200px;
}

.container1 {
    display: flex;
    /* flex-direction: row; */
}

.container2 {
    display: flex;
    flex-direction: column;
}

.box {
    border: 1px solid gray;
    padding: 2px;
}

.box1 {
    background-color: lightskyblue;
}

.box2 {
    background-color: lightskyblue;
    flex: 1;
}

.box3 {
    background-color: lightskyblue;
}

 

https://www.w3schools.com/cssref/css3_pr_flex.asp

 

CSS flex property

CSS flex Property Example Let all the flexible items be the same length, regardless of its content: #main div {   -ms-flex: 1; /* IE 10 */   flex: 1; } Try it Yourself » Tip: More "Try it Yourself" examples below. Definition and Usage The flex property

www.w3schools.com

 

https://developer.mozilla.org/ko/docs/Web/CSS/flex

 

flex - CSS: Cascading Style Sheets | MDN

flex CSS 속성은 하나의 플렉스 아이템이 자신의 컨테이너가 차지하는 공간에 맞추기 위해 크기를 키우거나 줄이는 방법을 설정하는 속성입니다.

developer.mozilla.org