-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss-regions-instead.html
105 lines (96 loc) · 3.11 KB
/
css-regions-instead.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
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<style>
.carousel {
position: relative;
display: grid;
height: 300px;
grid-template:
'previous scroller next' 1fr
'. markers .' auto
/ auto 1fr auto;
& li {
flow-into: carousel-contents;
}
/* The scroller itself.
Weird use of ::before? Could also add an additional DIV to establish the
region, but I suppose part of the exercise here is to avoid that. */
&::before {
display: block;
flow-from: carousel-contents;
grid-area: scroller;
overflow-x: auto;
scrollbar-width: none;
scroll-snap-type: x mandatory;
scroll-behavior: smooth;
overscroll-behavior-x: contain;
container-type: size;
height: 100%;
columns: 1;
position: relative;
text-align: center;
&::scroll-left-button, &::scroll-right-button {
width: 50px;
height: 50px;
border-radius: 50%;
border: 1px solid;
align-self: center;
position: absolute;
z-index: 1;
}
&::scroll-left-button {
grid-area: previous;
content: '<';
left: 0;
}
&::scroll-right-button {
grid-area: next;
content: '>';
right: 0;
}
&::fragment {
scroll-snap-align: center;
/* A "scroll marker". */
&::before {
content: "";
cursor: pointer;
flow-into: my-scroll-markers;
width: 1em;
height: 1em;
margin: 3px;
border-radius: 100%;
border: 2px solid #777;
background: transparent content-box;
&:checked {
background: SelectedItem content-box;
}
&:focus {
border-color: Highlight;
}
}
}
}
/* The "scroll marker group".
Similarly weird use of ::after */
&::after {
flow-from: my-scroll-markers;
grid-area: markers;
display: flex;
width: 100%;
height: 100%;
justify-content: center;
}
}
</style>
<p>Alternative to https://flackr.github.io/carousel/examples/carousel/image/
using CSS regions instead. Doesn't work. Just some ideas.</p>
<p>See <a href="https://drafts.csswg.org/css-regions/#properties">https://drafts.csswg.org/css-regions/#properties</a>.</p>
<ul class="carousel">
<li tabindex="0"><figure><img src="images/loc1.jpg"><figcaption>Item 1</figcaption></figure></li>
<li tabindex="0"><figure><img src="images/loc2.jpg"><figcaption>Item 2</figcaption></figure></li>
<li tabindex="0"><figure><img src="images/loc3.jpg"><figcaption>Item 3</figcaption></figure></li>
<li tabindex="0"><figure><img src="images/loc4.jpg"><figcaption>Item 4</figcaption></figure></li>
<li tabindex="0"><figure><img src="images/loc5.jpg"><figcaption>Item 5</figcaption></figure></li>
<li tabindex="0"><figure><img src="images/loc6.jpg"><figcaption>Item 6</figcaption></figure></li>
<li tabindex="0"><figure><img src="images/loc7.jpg"><figcaption>Item 7</figcaption></figure></li>
<li tabindex="0"><figure><img src="images/loc1.jpg"><figcaption>Item 8</figcaption></figure></li>
</ul>