-
Notifications
You must be signed in to change notification settings - Fork 0
/
25.html
57 lines (53 loc) · 1.62 KB
/
25.html
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
<!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 queries</title>
<style>
.screen{
font-size: 150px;
text-align: center;
/* display none will hide all the elements */
display: none;
}
/* media is declared outside the tag */
/* media is like if else,if condition is true then the corresponding element will be shown */
@media only screen and (max-width: 600px){
#screen1{
background-color: blueviolet;
color: aqua;
display: block;
}
}
@media only screen and (min-width: 601px) and (max-width: 1200px){
#screen2{
background-color: black;
color: white;
display: block;
}
}
@media only screen and (min-width: 1201px) and (max-width: 1500px){
#screen3{
background-color: chartreuse;
color: black;
display: block;
}
}
@media only screen and (min-width: 1501px){
#screen4{
background-color: red;
color: yellow;
display: block;
}
}
</style>
</head>
<body>
<div class="screen" id="screen1">Iphone screen</div>
<div class="screen" id="screen2">Ipad screen</div>
<div class="screen" id="screen3">Desktop screen</div>
<div class="screen" id="screen4">wide screen</div>
</body>
</html>