Skip to content

Instantly share code, notes, and snippets.

@djom202
Created May 25, 2018 00:20
Show Gist options
  • Save djom202/62b808e352f725509bcfd58f67786e22 to your computer and use it in GitHub Desktop.
Save djom202/62b808e352f725509bcfd58f67786e22 to your computer and use it in GitHub Desktop.
Setting 100% height of the screen
html, body {
height:100vh; /* viewport height */
}
/*
The second method is using the vh unit. Surely you already know that to determine the "size"
of an element in CSS we can use units such as pixels, points, percentages or even em. But
maybe you have not heard about the vh and vw units. A vh unit (viewport height) is
equivalent to 1% of the height of the viewport (the total of the screen of the device that
shows our web). 1vh = 1% of the total screen, 100vh = 100%. As you may have guessed, the
unit vw is the equivalent for the width.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment