Viewport Height (‘vh’) Unit
- ‘vh’ stands for viewport height. It represents a percentage of the viewport’s height and is equivalent to 1% of the viewport’s height.
- Commonly used for creating responsive designs where elements scale with the height of the viewport.
- ‘vh’ units are employed to establish dynamic vertical spacing between elements and are useful for maintaining consistent spacing relative to the height of the viewport.
Syntax
height: 50vh;
Explain the concept of the ‘vh’ and ‘vw’ units in CSS
The vh
(viewport height) and vw
(viewport width) units in CSS are relative length units that represent a percentage of the viewport dimensions. They provide a responsive way to size elements based on the dimensions of the user’s viewport. Here’s an explanation of these units: