Skip to content

Commit c9fc434

Browse files
Use svh for mobile Safari
1 parent 97f645e commit c9fc434

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Public/css/common.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
body {
22
height: 100vh;
3+
height: 100svh;
34
}
45

56
.swift-logo {

Public/js/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export class App {
1919
get contentViewHeight() {
2020
const headerHeight = document.querySelector("header").clientHeight;
2121
const footerHeight = document.querySelector("footer").clientHeight;
22-
return `calc(100vh - ${headerHeight}px - ${footerHeight}px)`;
22+
const viewport = CSS.supports("height", "100svh") ? "100svh" : "100vh";
23+
return `calc(${viewport} - ${headerHeight}px - ${footerHeight}px)`;
2324
}
2425

2526
constructor() {

0 commit comments

Comments
 (0)