flex 요소들의 수직방향 정렬방식을 설정
아래의 크기는 플렉스 컨테이너는 (500px 150px), 요소들은 100px이다.
기본설정, 플렉스 요소의 높이가 컨테이너의 높이와 같게 변경된 뒤 연이어 배치된다.

플렉스 요소는 플렉스 컨테이너의 위쪽에 배치된다.

플렉스 요소는 플렉스 컨테이너의 아래쪽에 배치된다.

플렉스 요소는 플렉스 컨테이너의 가운데에 배치된다.

플렉스 요소는 컨테이너의 기준선에 배치된다.

플레스 요소마다 서로 다른 align 속성 값을 설정할 수 있다.
box1은 center, 2는 stretch, 3는 flex-end로 설정하였다.

플렉스 요소들의 순서를 설정
order를 적용하여 순서를 바꾸었다. 숫자가 낮을 수록 먼저임

플렉스 아이템들이 차지할 너비들에 대한 증가형 숫자를 지정
각각 box들의 flex-grow를 설정하여 비율을 1 : 2 : 3으로 grow시킴

플렉스 아이템들이 차지할 너비들에 대한 감소형 숫자를 지정
각각 box들의 flex-shrink 설정하여 비율을 2 : 2 : 1으로 shrink시킴

플렉스 아이템들의 길이를 지정
(max-content, min-content, fit-content, content, auto..)
플렉스의 속성을 한꺼번에 설정
width, height, color, ... 속성과 같은 미디어 관련 표현식을 통해 스타일이 적용되는 범위를 조절(반응형 웹 개발)
컨텐츠를 별도로 변경하지 않아도 웹페이지에 접속하고 있는 기기에 따라 알맞은 형태로 스타일을 조절
@media 매체유형 and 조건....{
적용할 스타일 코드
}
매체유형
all : 모든 매체
screen : 컴퓨터, 태블릿, 스마트폰, ...
print : 프린터 기기
speech : 스크린 리더
html
<!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>솔로의 식탁</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div id="container">
<header>
<h1>솔로의 식탁</h1>
</header>
<section id="menus">
<div id="menu1"><h2>밥/죽</h2></div>
<div id="menu2"><h2>국/찌개</h2></div>
<div id="menu3"><h2>반찬</h2></div>
<div id="menu4"><h2>일품요리</h2></div>
<div id="menu5"><h2>음료/칵테일</h2></div>
</section>
<footer>
<p>Copyright©211106 (주)솔로의 식탁</p>
</footer>
</div>
</body>
</html>
css
/* common */
section > div {
height: 400px;
}
header {
text-align: center;
font-size: 1.5em;
}
footer {
font-size: 1.5em;
color: white;
text-shadow: 2px 2px 5px black;
margin: 10px;
background-color: rgba(104, 84, 154, 0.3);
}
footer > p {
font-size: 1em;
font-weight: bold;
color: white;
text-align: center;
margin-left: 10px;
font-variant: small-caps;
}
#menu1 {
background-image: url(./images/dish1.jpg);
}
#menu2 {
background-image: url(./images/dish2.jpg);
}
#menu3 {
background-image: url(./images/dish3.jpg);
}
#menu4 {
background-image: url(./images/dish4.jpg);
}
#menu5 {
background-image: url(./images/dish5.jpg);
}
/* mobile */
@media screen and (min-width: 480px) and (max-width: 720px) {
section > div > h2 {
font-size: 1.2em;
color: white;
text-shadow: 2px 2px 5px black;
position: relative;
top: 85%;
left: 82%;
}
#menu1,
#menu2,
#menu3,
#menu4,
#menu5 {
width: 100%;
margin: 10px;
display: block;
background-size: cover;
background-repeat: no-repeat;
border: 1px solid black;
}
footer {
border: 1px solid black;
width: 100%;
clear: both;
}
}
/* tablet */
@media screen and (min-width: 720px) {
section > div > h2 {
font-size: 1.2em;
color: white;
text-shadow: 2px 2px 5px black;
position: relative;
top: 80%;
left: 75%;
}
#menu1 > h2,
#menu3 > h2,
#menu5 > h2 {
position: relative;
top: 80%;
left: 85%;
}
#menu1,
#menu2,
#menu3,
#menu4 {
height: 280px;
width: 45%;
background-repeat: no-repeat;
background-size: cover;
border: 1px solid black;
float: left;
margin: 10px;
}
#menu5 {
height: 280px;
background-repeat: no-repeat;
background-size: cover;
border: 1px solid black;
margin: 10px;
width: 92%;
float: left;
}
footer {
border: 1px solid black;
width: 92%;
clear: both;
}
}
/* pc */
@media screen and (min-width: 1200px) {
section > div > h2 {
font-size: 1.2em;
color: white;
text-shadow: 2px 2px 5px black;
position: relative;
top: 80%;
left: 70%;
}
#menu1 > h2,
#menu3 > h2,
#menu2 > h2 {
position: relative;
top: 80%;
left: 82%;
}
#menu4 > h2 {
position: relative;
top: 80%;
left: 80%;
}
#menu5 > h2 {
position: relative;
top: 80%;
left: 85%;
}
#menu1,
#menu2,
#menu3,
#menu4 {
height: 400px;
width: 31%;
background-repeat: no-repeat;
background-size: cover;
border: 1px solid black;
float: left;
margin: 10px;
}
#menu5 {
height: 400px;
background-repeat: no-repeat;
background-size: cover;
border: 1px solid black;
margin: 10px;
width: 63.44%;
float: left;
}
footer {
border: 1px solid black;
width: 96%;
clear: both;
}
}
<무료호스팅 특성 상 홈페이지가 변경될 수 있음>

em : 단위는 상위 요소 크기의 몇 배인지를 나타내는 크기(부모-자식요소)
rem : 단위는 최상위 요소 크기의 몇 배인지를 나타내는 크기(손자요소)
상대크기를 알기위한 변환사이트를 참고하면 좋다.