- 아래를 예를 들어 설명하시오.
- flex-direction - flex-wrap - flex-flow - justify-content - align-items - align-content- order - flex-grow - flex-shrink - flex-basis - flex
- flex 로 holy grail을 완성 하시오.
- 커피숍 프로젝트를 완성하시오.
물론 작성한 내용은 위 사이트 내용을 그대로 옮긴 게 아니다. 내 개인적인 수업 정리본을 가져온 것이다.
flex-direction
flex-wrap
justify-content
align-items
order
flex-grow
flex-shrink
<div class="flex-container">
<div>1</div>
<div>2</div>
<div style="flex-shrink: 0;">3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
</div>
flex-basis
<div class="flex-container">
<div>1</div>
<div>2</div>
<div style="flex-basis: 200px;">3</div>
<div>4</div>
</div>
flex: 0 0 200px;
연습파일.
해당 부분에서 염두하게 된 요소 : container 크기 조절 시 vw, vh를 적절하게 사용할 수 있어야 한다.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
width: 100vw;
height: 100vh;
display: flex;
flex-wrap: wrap;
flex-direction: column;
text-align: center;
color: rgba(240, 248, 255, 0.849);
}
header {
width: 100%;
height: 15vh;
background-color: blue;
line-height: 15vh;
}
.contents {
width: 100%;
height: 70vh;
display: flex;
padding: 5px;
}
.contents div {
width: 25%;
line-height: 30vh;
margin: 5px;
background-color: palevioletred;
}
.contents .main-content {
flex: 2;
background-color: greenyellow;
}
footer {
height: 15vh;
line-height: 15vh;
background-color: aqua;
}
@media screen and (max-width:700px) {
.container {
width: 100vw;
height: 100vh;
display: flex;
flex-wrap: wrap;
flex-direction: column;
text-align: center;
color: rgba(240, 248, 255, 0.849);
}
header {
width: 100%;
height: 10vh;
background-color: blue;
line-height: 10vh;
}
.contents {
width: 100%;
height: 70vh;
display: flex;
flex-direction: column;
padding: 5px;
}
.contents div {
width: 100%;
line-height: 13vh;
margin: 5px;
background-color: palevioletred;
}
.contents .subnav, .contents .sidebar{
flex: 1;
}
.contents .main-content {
flex: 2;
background-color: greenyellow;
}
footer {
height: 10vh;
line-height: 10vh;
background-color: aqua;
}
}
</style>
</head>
<body>
<div class="container">
<header>HEADER</header>
<div class="contents">
<div class="subnav">SUBNAV</div>
<div class="main-content">MAIN CONTENT</div>
<div class="sidebar">SIDEBAR</div>
</div>
<footer>FOOTER</footer>
</div>
</body>
</html>