-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss-image-carousel.html
94 lines (93 loc) · 2.58 KB
/
css-image-carousel.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CSS Image Carousel</title>
<style>
.wrapper {
width: 100vw;
height: 100vh;
display: grid;
place-items: center;
background: saddlebrown;
}
.slider {
width: 1000px;
height: 100px;
background: whitesmoke;
box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.3);
position: relative;
display: flex;
overflow: hidden;
}
.slide {
height: 100px;
display: flex;
align-items: center;
animation: carousel 8s linear infinite;
}
.slide img {
padding: 0 30px;
height: 70px;
}
@keyframes carousel {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
.slider::before,
.slider::after {
content: "";
height: 100px;
width: 200px;
position: absolute;
background: linear-gradient(
to right,
white 0%,
rgba(255, 255, 255, 0) 100%
);
z-index: 2;
}
.slider::before {
top: 0;
left: 0;
}
.slider::after {
top: 0;
right: 0;
transform: rotateZ(180deg);
/* background: magenta; */
}
</style>
</head>
<body>
<div class="wrapper">
<div class="slider">
<div class="slide">
<img src="img/carousel/013-olive oil.png" alt="" />
<img src="img/carousel/015-bruschetta.png" alt="" />
<img src="img/carousel/021-dessert.png" alt="" />
<img src="img/carousel/024-burger.png" alt="" />
<img src="img/carousel/025-breakfast.png" alt="" />
<img src="img/carousel/031-tea.png" alt="" />
<img src="img/carousel/042-pot.png" alt="" />
<img src="img/carousel/050-cocktail.png" alt="" />
</div>
<div class="slide">
<img src="img/carousel/013-olive oil.png" alt="" />
<img src="img/carousel/015-bruschetta.png" alt="" />
<img src="img/carousel/021-dessert.png" alt="" />
<img src="img/carousel/024-burger.png" alt="" />
<img src="img/carousel/025-breakfast.png" alt="" />
<img src="img/carousel/031-tea.png" alt="" />
<img src="img/carousel/042-pot.png" alt="" />
<img src="img/carousel/050-cocktail.png" alt="" />
</div>
</div>
</div>
</body>
</html>