CSS allows to adjust the height of an element using the height property. While there are several units to specify the height of an element. The vh is a relative unit that is commonly used.
vh: It stands for viewport-height. The viewport refers to the browser window size. Thus when use vh as a unit, the element’s height is adjusted relative to the browser window (viewport’s) height.
vw: It stands for viewport-width. It is used to set the browser width 100% relative to the browser window (viewport’s) width.
Syntax: To set a div element height to 100% of the browser window, it can simply use the following property of CSS:
- How to get the size of screen, current web page and browser window using jQuery?
- Difference between Web Browser and Web Server
- How to open a PDF files in web browser using PHP?
- How to jump to top of browser page using jQuery?
- How to disable browser Autocomplete on web form field/input tag?
- How to give text or an image transparent background using CSS?
- CSS | max-height Property
- CSS | min-height Property
- CSS | Height and Width
- How to change the height of br tag?
- CSS | height Property
- p5.js | height variable
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.