-1👍
To set a element’s height to 100% of the browser window, you can simply use the vh
property of CSS:
div {
height: 100vh;
width: 100%;
}
It’s good to give this height to the root element of your app, so the root’s height will always be equal to the browser window’s height.
Tip-
If you see a vertical scrollbar after applying vh
this is because of extra margin and padding of the body, so do this-
html,
body {
margin: 0;
padding: 0;
}
Read more about viewport vs percentage units
Source:stackexchange.com