<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
text-align: center;
font-size: 15pt;
font-family: monospace;
background-color: lightgrey;
height: 200vh;
}
div {
box-sizing: border-box;
position: absolute;
top: 0;
left: calc((var(--width) + 4px) * var(--index));
width: var(--width);
writing-mode: vertical-lr;
line-height: calc(var(--content-width) - var(--border-width) / 2);
background-color: white;
border: var(--border-width) solid steelblue;
--content-width: 1.5em;
--border-width: 4px;
--width: calc(1.5em + var(--border-width));
}
input {
position: fixed;
top: 4px;
right: 4px;
z-index: 1;
}
</style>
<script>
function updateComputedValues()
{
document.querySelector(".inner-height").style.height = window.innerHeight + "px";
for (let span of document.querySelectorAll("span"))
span.textContent = "(" + window.getComputedStyle(span.parentNode).height + ")";
}
window.addEventListener("resize", () => {
updateComputedValues();
});
window.addEventListener("load", () => {
let index = 0;
function createDiv(height) {
let div = document.body.appendChild(document.createElement("div"));
div.style.setProperty("--index", index++);
div.style.setProperty("height", height);
div.textContent = height + " ";
let span = div.appendChild(document.createElement("span"));
return div;
}
let fixed = createDiv("fixed");
fixed.style.setProperty("position", "fixed");
fixed.style.setProperty("height", "100%");
let windowInnerHeight = createDiv("inner-height");
windowInnerHeight.className = "inner-height";
[
"100%",
"100vh",
"100svh",
"100lvh",
"100dvh",
"calc(100vh - env(safe-area-inset-bottom))",
"-webkit-fill-available",
].forEach((height) => {
createDiv(height);
});
updateComputedValues();
});
</script>
</head>
<body>
<input>
</body>
</html>