728x90
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="style.css" />
<title>Flexbox</title>
</head>
<body>
<div id="container">
<div class="item">아이템 1</div>
<div class="item">아이템 2</div>
<div class="item">아이템 3</div>
<div class="item">아이템 4</div>
<div class="item">아이템 5</div>
<div class="item">아이템 6</div>
<div class="item">아이템 7</div>
<div class="item">아이템 8</div>
<div class="item">아이템 9</div>
<div class="item">아이템 10</div>
</div>
</body>
</html>
body {
padding: 0;
margin: 0;
}
#container {
width: 40%;
margin: 0 auto;
background: tomato;
text-align: center;
}
.item {
width: 30%;
height: 300px;
background: skyblue;
margin: 1%;
display: inline-block;
}
@media screen and (max-width: 1100px) {
#container {
width: 80%;
}
.item {
width: 30%;
margin: 1%;
}
}
@media screen and (max-width: 800px) {
#container {
width: 80%;
}
.item {
width: 44%;
margin: 1%;
}
}
@media screen and (max-width: 450px) {
#container {
width: 80%;
}
.item {
width: 100%;
margin: 0px;
margin-bottom: 10px;
}
}
728x90
'프론트엔드 > CSS' 카테고리의 다른 글
flex 없이 탭 네비게이션 만들기 (0) | 2021.11.04 |
---|---|
flex 없이 중앙정렬하기 (0) | 2021.11.04 |
칼럼 (Column) 레이아웃 (0) | 2021.10.24 |
Grid 기본이론 (0) | 2021.10.19 |
반응형 웹 (Responsive web) (0) | 2021.10.18 |