Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Kevin D
Kevin D
8,646 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
227,114 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.