




<!DOCTYPE html>
<html lang="ko">
<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>09-01-grid</title>
    <link rel="stylesheet" href="./index.css">
</head>
<body>
    <div class="container">
        <div class="item item1">item1</div>
        <div class="item item2">item2</div>
        <div class="item item3">item3</div>
        <div class="item item4">item4</div>
        <div class="item item5">item5</div>
        <div class="item item6">item6</div>
    </div>
</body>
</html>* {
    box-sizing: border-box;
}
.container {
    border: 2px solid red;
    display: grid;
    grid-template-columns: repeat(2, 1fr 2fr);
    grid-template-rows: repeat(3,100px);
    grid-gap: 5px;
}
.item {
    border: 2px solid blue;
}
.item1 {
    grid-column: 1 / span 2;
    /* span n = n칸을 차지한다 */
    grid-row: 1 / span 3;
    background-color: green;
}grid-item이 열과 행 방향으로 얼마만큼의 영역을 차지할 지 정의
시작점이 되는 grid-number와 종료지점이 되는 grid-number 입력

    
@media screen and (max-width: 500px) {
	/* 스크린의 너비가 500px 이하일 경우 적용시킬 스타일 시트를 적습니다. */
}
<!DOCTYPE html>
<html lang="ko">
<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>10-01-media-query</title>
    <link rel="stylesheet" href="./index.css">
</head>
<body>
    <div class="box">
        박스입니다.
    </div>
    <div class="container">
        <div class="box1">
            박스1
        </div>
        <div class="box2">
            박스2
        </div>
    </div>
</body>
</html>* {
    box-sizing: border-box;
}
.box {
    height: 200px;
    background-color: blue;
    color: white;
    padding: 30px;
}
@media screen and (max-width: 600px){
    .box {
        background-color: red;
    }    
}
.container {
    display: flex;
    flex-direction: row;
}
.box1 {
    width: 20%;
    background-color: green;
    color: white;
    padding: 30px;
}
.box2 {
    width: 80%;
    background-color: orange;
    color: white;
    padding: 30px;
}
@media screen and (min-width: 601px) {
    .container {
        flex-direction: column;
    }
    .box1 {
        width: 100%;
    }
    .box2 {
        width: 100%;
    }
}<!DOCTYPE html>
<html lang="ko">
<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>10-02-break-point</title>
    <link rel="stylesheet" href="./index.css">
</head>
<body>
    <div class="container">
        <span class="contents">
            안녕하세요.
        </span>
    </div>
</body>
</html>* {
    box-sizing: border-box;
}
.container {
    width: 100%;
    background-color: red;
    padding: 30px;
}
.contents {
    color: white;
}
.contents:after {
    content: "저는 PC입니다.";
}
/* pc 기본 설정 */
@media screen and (max-width: 767px) {
    /* mobile */
    .container {
        background-color: blue;
    }
    .contents:after {
        content: "저는 mobile입니다";
    }
}
@media screen and (min-width: 768px) and (max-width: 1023px) {
    /* tablet */
    .container {
        background-color: green;
    }
    .contents:after {
        content: "저는 tablet입니다";
    }
}출처 : 코드캠프