forked from dollarshaveclub/stickybits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.css
54 lines (54 loc) · 835 Bytes
/
test.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
body,
html {
color: white;
font-family: sans-serif;
margin: 0;
padding: 0;
}
main {
counter-reset: div;
display: flex;
height: 100%;
justify-content: space-between;
max-width: 100vw;
min-height: 2000px;
position: absolute;
top: 400px;
width: 100%;
}
.child {
padding: 1rem 0;
text-indent: 1rem;
width: 100%;
}
.parent {
height: 300px;
position: relative;
width: 100%;
}
.parent:nth-child(odd) {
background: tan;
}
.parent:nth-child(odd) .child {
background-color: red;
}
.parent:nth-child(even) {
background: aqua;
}
.parent:nth-child(even) .child {
background-color: green;
}
.parent:before {
counter-increment: div;
content: 'Parent 'counter(div);
left: 1rem;
position: absolute;
top: 1rem;
z-index: 2;
}
.child.js-is-sticky {
top: 0;
}
.child.js-is-stuck {
bottom: 0;
}