/
5-responsive.html
53 lines (51 loc) · 1.22 KB
/
5-responsive.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
<html>
<head>
<title>Responsive</title>
<style>
body {
font-size: 14px;
}
.colorblock {
width: 200px;
height: 200px;
background-color: green;
}
.colorblock:hover {
background-color: lime;
}
.colorblock:active {
background-color: #afa; /* pastel green */
}
@media screen and (max-width: 700px) {
body {
font-size: 2em; /* a slightly more tablet friendly font size */
}
.colorblock {
background-color: red;
}
.colorblock:hover {
background-color: magenta;
}
.colorblock:active {
background-color: pink;
}
}
@media screen and (max-width: 500px) {
body {
background-color: #ffc; /* light yellow */
font-size: 3em; /* mobile-friendly! */
}
.colorblock {
background-color: blue;
}
.colorblock:hover {
background-color: #0ff; /* bright blue */
}
}
</style>
</head>
<body>
Hello world.
<div class="colorblock"></div>
</body>
</html>