blob: 4f4b4309fb70c4b144333fa6a077fbf1b9029233 (
plain)
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
|
<!DOCTYPE html>
<html>
<body>
<style>
.scroller {
width: 200px;
height: 200px;
border: solid 1px black;
overflow: scroll;
scroll-snap-type: both mandatory;
position: relative;
resize: both;
}
.target {
scroll-snap-align: start;
width: 50px;
height: 50px;
background-color: green;
position: absolute;
}
.target:target {
background-color: blue;
}
.target:focus {
background-color: yellow;
}
#box1 {
left: 150px;
top: 0px;
}
#box2 {
left: 0px;
top: 150px;
}
.space {
width: 500%;
height: 500%;
position: absolute;
}
</style>
<div class="scroller" id="scroller">
<div tabindex="1" id="box1" class="target">Box 1</div>
<div tabindex="1" id="box2" class="target">Box 2</div>
<div class="space"></div>
</div>
</body>
</html>
|