Skip to content

Instantly share code, notes, and snippets.

@LukeChannings
Last active February 17, 2023 17:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LukeChannings/efdd456bccc3ee1459eacc663e9abc24 to your computer and use it in GitHub Desktop.
Save LukeChannings/efdd456bccc3ee1459eacc663e9abc24 to your computer and use it in GitHub Desktop.
Viewport Height Test
<meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover">
<title>Viewport Height Test</title>
<style>
body {
font-family: -apple-system, 'Helvetica Neue', sans-serif;
margin: 0;
}
main {
width: 100vw;
height: calc(100vh - env(safe-area-inset-bottom));
display: flex;
flex-direction: column;
align-items: center;
}
main > h1 {
max-width: 80%;
text-align: center;
}
main > button {
margin-top: auto;
border-radius: 5px;
background-color: hsl(200, 40%, 25%);
color: hsl(0, 100%, 100%);
padding: 1rem 4rem;
font-size: 1rem;
margin-bottom: 1rem;
}
</style>
<main>
<h1>Does Safari 15 finally fix the viewport height bug?</h1>
<button>Yes it does!</button>
</main>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment