Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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