HTML, CSS
(61)CSS_플렉스 레이아웃2
빠스무
2023. 4. 3. 17:18
728x90
- 플렉스 레이아웃 2번째 예제
- 아래 링크를 통해 각 태그들의 설명을 볼 수 있다.
- https://jm-rograming.tistory.com/95
(56)CSS_레이아웃 기본 문법
다단 레이아웃 텍스트를 column 속성으로 다단을 생성 다단은 레이아웃을 여러개의 컬럼으로 쪼개서 구성한다는 의미 column-count: 단의 갯수를 설정 column-rule: 단과 단사이의 구분선, 구분의 모양,
jm-rograming.tistory.com
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>플렉스 레이아웃2</title>
<style>
.wrapper{
width: 500px;
height: 200px;
margin: 0 auto;
border: 3px solid red;
}
.wrapper div{
width: 50px;
border: 2px solid black;
background-color: gold;
}
#container{
display: flex;
/* justify-content: flex-start; 기본값*/
/* justify-content: flex-end; */
/* justify-content: center; */
/* justify-content: space-between; */
justify-content: space-around;
/* align-items: stretch; 기본값*/
/* align-items: start; */
/* align-items: flex-end */
/* align-items: center; */
align-items: baseline;
}
#box2{align-self: flex-end;}
#box1{order: 5;}
#box2{order: 3;}
#box3{order: 2;}
#box4{order: 1;}
#box5{order: 4;}
</style>
</head>
<body>
<h2>플렉스 레이아웃2</h2>
<div id="container" class="wrapper">
<div id="box1">
<p>1</p>
</div>
<div id="box2">
<p>2</p>
</div>
<div id="box3">
<p>3</p>
</div>
<div id="box4">
<p style="font-size: 50px;">4</p>
</div>
<div id="box5">
<p>5</p>
</div>
</div>
</body>
</html>