-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path01-media-queries.html
More file actions
64 lines (52 loc) · 1.53 KB
/
Copy path01-media-queries.html
File metadata and controls
64 lines (52 loc) · 1.53 KB
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
<!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">
<title>Media Queries</title>
<style>
body {
padding-top: 100px;
background: gray;
color: white;
font-family: Arial, Helvetica, sans-serif;
text-align: center;
}
h1 { display: none; }
/* Smartphones */
@media only screen and (max-width: 500px) {
body { background: red; }
#smartphone h1 { display: block; }
}
/* Tablet */
@media(min-width: 501px) and (max-width: 768px) {
body { background: blue; }
#tablet h1 { display: block; }
}
/* Normal */
@media(min-width: 769px) and (max-width: 1200px) {
body { background: green; }
#normal h1 { display: block; }
}
/* Widescreen */
@media(min-width: 1201px) {
body { background: black; }
#widescreen h1 { display: block; }
}
/* Landscape */
@media(max-height: 500px) {
body { background: orange; }
#landscape h1 { display: block; }
}
</style>
<!-- <link rel="stylesheet" media="screen and (max-width: 768px)" href="mobile.css"> -->
</head>
<body>
<div id="widescreen"><h1>Widescreen</h1></div>
<div id="normal"><h1>Normal</h1></div>
<div id="tablet"><h1>Tablet</h1></div>
<div id="smartphone"><h1>Smartphone</h1></div>
<div id="landscape"><h1>Landscape</h1></div>
</body>
</html>