-
Notifications
You must be signed in to change notification settings - Fork 29
/
mediaquery.htm
81 lines (70 loc) · 1.94 KB
/
mediaquery.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!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>media query </title>
<style>
.box{
background-color: coral;
font-size: 2vw;
text-align: center;
display: none;
}
@media (min-width:200px) and (max-width:400px){
#box1{
background-color: tomato;
font-family: cursive;
display: block;
margin-top: 123px;
font-size: 8em;
}
}
@media (min-width:400px) and (max-width:600px){
#box5{
background-color:slateblue;
font-family: fantasy;
font-size: 8em;
display: block;
margin-top: 123px;
}
}
/* media query is just like if else condition */
@media (min-width:600px) and (max-width:800px){
#box2{
background-color: springgreen;
font-family: fantasy;
display: block;
margin-top: 123px;
font-size: 8em;
}
}
@media (min-width:800px) and (max-width:1000px){
#box3{
background-color: rgb(0, 17, 255);
font-family: serif;
display: block;
margin-top: 123px;
font-size: 8em;
}
}
@media (min-width:1000px) and (max-width:1200px){
#box4{
background-color: rgb(204, 54, 184);
font-family: Arial, Helvetica, sans-serif;
display: block;
margin-top: 123px;
font-size: 8em;
}
}
</style>
</head>
<body>
<div class="box" id="box1"> Hey </div>
<div class="box" id="box5">coder's</div>
<div class="box" id="box2"> how's </div>
<div class="box" id="box3"> you </div>
<div class="box" id="box4">all </div>
</body>
</html>