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?
- Web Window API | Window menubar property
- Web Window API | Window statusbar property
- Web Window API | Window scrollbars property
- Web Window API | Window toolbar property
- Web Window API | DOM Window fullscreen property
- Web Window API | Window locationbar property
- Window | Window.requestAnimationFrame() Method
- Web Window API | Window personalbar property
- HTML width/height Attribute vs CSS width/height Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.