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! While you're at it, check out some resources Treehouse students have shared here.

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

CSS CSS Basics (2014) Enhancing the Design With CSS Media Query Basics

Mike Jensen
Mike Jensen
11,718 Points

How can a percentage value be used with the media features height and width?

Guil mentions that this is possible. But how? Aren't percentage lengths defined relative to parents elements? In this case, there is no parent element, so what should the value be relative to? I tried to test this myself and it didn't work.

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

When you're defining a percentage for a root element, the value is relative to the viewport (i.e. your web browser window.) :-)

Hope this helps!