-
Notifications
You must be signed in to change notification settings - Fork 41
/
carousel.css
56 lines (49 loc) · 1 KB
/
carousel.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
html, body {
margin: 0;
height: 100vh; /* enable scrolling away the URL bar on mobile */
background: black;
}
:root {
/* Configuration */
--img-width: 50vw;
--img-height: calc(var(--img-width) * 3/4);
--img-padding: 5vw;
}
#scroller {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100vh;
overflow-x: scroll;
scroll-snap-type: x mandatory;
display: flex;
align-items: center;
}
img {
flex: 1;
width: var(--img-width);
height: var(--img-height);
padding: 0 var(--img-padding);
scroll-snap-align: center;
}
img:first-child {
padding-left: calc( (100vw - var(--img-width)) / 2);
}
img:last-child {
padding-right: calc( (100vw - var(--img-width)) / 2);
}
#features {
position: fixed;
bottom: 10px;
width: 100vw;
font-size: small;
padding-left: 10px;
color: #303030;
}
@supports not (scroll-snap-type: x mandatory) {
#feature-snap {
color: red;
text-decoration: line-through;
}
}