-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
64 lines (62 loc) · 1.64 KB
/
index.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
58
59
60
61
62
63
64
<!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>Responsive images with the image-set() CSS function</title>
<style>
* {
box-sizing: border-box;
}
body {
overflow-x: hidden;
text-align: center;
font-family: sans-serif;
}
figure {
max-width: 1440px;
margin-bottom: 40px;
}
img {
display: block;
width: 100%;
height: auto;
}
.car {
width: 100%;
height: 500px;
background-image: url("./img/2400by1592.jpg");
background-image: -webkit-image-set(
url("./img/640by425.jpg") 1x,
url("./img/1200by796.jpg") 2x,
url("./img/2400by1592.jpg") 3x
);
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
@media screen and (max-width: 800px) {
.car {
margin: auto;
width: 500px;
height: 300px;
}
}
@media screen and (max-width: 600px) {
.car {
margin: auto;
width: 300px;
height: 200px;
}
}
</style>
</head>
<body>
<h1>Responsive images with the image-set() CSS function</h1>
<h2>Code example links</h2>
<p><a href="./resolution-switching.html">1. Resoluton Switching</a></p>
<p><a href="./art-direction.html">2. Art Direction</a></p>
<p><a href="./responsive-images.html">2. Responsive Images</a></p>
</body>
</html>