Skip to content

Commit 98a259d

Browse files
committed
CSS Media Queries Practice
0 parents commit 98a259d

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

CSS-Media Queries/index.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
.container {
2+
display: flex;
3+
gap: 30px;
4+
}
5+
6+
.box1,
7+
.box2 {
8+
width: 150px;
9+
height: 150px;
10+
background-color: rgb(248, 130, 130);
11+
}
12+
13+
@media (min-width: 1200px) {
14+
.box1 {
15+
width: 80%;
16+
}
17+
}
18+
19+
@media (min-width: 992px) and (max-width: 1199px) {
20+
.container {
21+
flex-direction: column;
22+
}
23+
.box1,
24+
.box2 {
25+
width: 80%;
26+
}
27+
}
28+
29+
@media (min-width: 768px) and (max-width: 991px) {
30+
.container {
31+
flex-direction: column;
32+
}
33+
.box1,
34+
.box2 {
35+
width: 80%;
36+
}
37+
}
38+
39+
@media (min-width: 428px) and (max-width: 777px) {
40+
.container {
41+
flex-direction: column;
42+
}
43+
.box1,
44+
.box2 {
45+
width: 60%;
46+
}
47+
}
48+
49+
@media (min-width: 258px) and (max-width: 427px) {
50+
.container {
51+
flex-direction: column;
52+
align-items: center;
53+
}
54+
}

CSS-Media Queries/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Media Queries</title>
7+
<link rel="stylesheet" href="./index.css" />
8+
</head>
9+
<body>
10+
<h2 class="media">Media Queries</h2>
11+
12+
<div class="container">
13+
<div class="box1">Box 1</div>
14+
<div class="box2">Box 2</div>
15+
</div>
16+
</body>
17+
</html>

0 commit comments

Comments
 (0)