File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,46 @@ export class App extends LitElement {
84
84
error : string | null = null ;
85
85
86
86
static styles = css `
87
+ /* Sticky headings. */
87
88
h2 {
88
89
margin-top: 2rem;
90
+ position: sticky;
91
+ top: 0;
92
+ background: var(--bg-color);
93
+ margin: 0;
94
+ padding: 1rem 0;
89
95
}
96
+
97
+ /* First h2 gets z-index 10 */
98
+ h2:nth-of-type(1) {
99
+ z-index: 10;
100
+ }
101
+
102
+ /* Second h2 gets z-index 30 */
103
+ h2:nth-of-type(2) {
104
+ z-index: 30;
105
+ }
106
+
107
+ h3 {
108
+ position: sticky;
109
+ top: 3rem;
110
+ background: var(--bg-color);
111
+ margin: 0;
112
+ padding: 0.5rem 0;
113
+ }
114
+
115
+ /* First two h3s get z-index 20 */
116
+ h3:nth-of-type(1),
117
+ h3:nth-of-type(2) {
118
+ z-index: 20;
119
+ }
120
+
121
+ /* Last two h3s get z-index 40 */
122
+ h3:nth-of-type(3),
123
+ h3:nth-of-type(4) {
124
+ z-index: 40;
125
+ }
126
+
90
127
.error {
91
128
color: red;
92
129
}
You can’t perform that action at this time.
0 commit comments