-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
55 lines (50 loc) · 1.36 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>100vh</title>
<style>
body {
margin: 0;
display: flex;
flex-wrap: wrap;
height: 200vh;
background-color: gray;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}
.section {
flex-grow: 1;
height: 100vh;
box-shadow: inset 0px 0px 0px 1rem var(--section-color);
background-color: white;
display: grid;
place-items: center;
}
.section-1 {
--section-color: orangered;
}
.section-2 {
--section-color: limegreen;
height: calc(var(--vh, 1vh) * 100);
}
</style>
</head>
<body>
<section class="section section-1">
<h1>Before</h1>
</section>
<section class="section section-2">
<h1>After</h1>
</section>
<script>
let vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty("--vh", `${vh}px`);
window.addEventListener("resize", () => {
let vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty("--vh", `${vh}px`);
});
</script>
</body>
</html>