Interview Question

What is vh and vw?

vw follows viewport width and vh follows viewport height.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

vh and vw are viewport-percentage length units. • 1vw equals one percent of the viewport width. • 1vh equals one percent of the viewport height in the default viewport model. • Mobile browser UI can make svh, lvh, or dvh more appropriate.

💡 Simple Example

.banner { width: 100vw; min-height: 50vh; }

⚡ Quick Revision

vw follows viewport width and vh follows viewport height.