-
Notifications
You must be signed in to change notification settings - Fork 1
/
style.css
66 lines (58 loc) · 1.64 KB
/
style.css
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
body {
margin: 0;
display: flex;
flex-direction: column;
background-color: grey;
height: 100vh;
justify-content: center;
align-items: center;
text-align: center;
overflow: hidden;
}
.image-container {
position: relative;
width: 200px;
height: 200px;
transform-style: preserve-3d;
transform: perspective(1000px) rotateY(0deg);
/* the 3D object is positioned 1000 pixels away from the user. the element is rotated 0 degrees around the Y-axis, which means it is not rotated at all */
transition: transform 0.7s;
/* when the "transform" property is changed, such as when an element is being rotated, scaled or translated, the change will be animated over a period of 0.7 seconds, creating a smooth and gradual transition effect. */
}
.image-container span {
position: absolute;
top: 0;
left: 0;
width: 100%;
transform: rotateY(calc(var(--i) * 45deg)) translateZ(400px);
/* This rotates the element around the Y-axis by a certain angle. The calc() function performs a mathematical calculation, and in this case, it multiplies the value of a custom property --i by 45 degrees. */
/* This moves the element along the Z-axis, which is the depth axis in a 3D space */
}
.image-container span img {
position: absolute;
top: 0;
left: 0;
width: 100%;
}
.btn-container {
position: relative;
width: 80%;
}
.btn {
position: absolute;
bottom: -80px;
background-color: darkgray;
border: 1px solid black;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
}
.btn:hover {
filter: brightness(1.5);
}
#prev {
left: 20%;
}
#next {
right: 20%;
}