Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Kevin D
Kevin D
8,621 Points

Is viewport percentage lengths a reliable measurement unit? (i.e. is it well supported in today's browsers?)

Hi all,

I remember playing around with vh and vw units when I was messing around creating website layouts; although they were really useful for making divs fill the window size, some browsers didn't support its use at the time.

Has this changed? Are they well supported now in browsers?

I found this website: http://caniuse.com/#feat=viewport-units But was wondering if anyone could enlighten us with any personal experiences they had with using vh and vw units(?) And if it's a good idea to switch to using these or to just keep with percentages when creating a website today?


1 Answer

Steven Parker
Steven Parker
216,057 Points

A good resource to be familiar with is Can I Use?, which shows that viewport units are supported by all current browsers except Opera Mini.

Still, I wouldn't "switch" to using them where percentages do the job. Remember, they do different things: percentages are based on the containing element, viewport units are based on the window. Just add them to your collection of resources, and use them when they are the most appropriate choice.