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
The min-width value in media query
In this video, the min-width value is set as 769px. I right click the page and select inspect, the value on the top right corner becomes 769px after I zoom in the page. However, I noticed that the body's width is only shown as 754px. I am not sure why these two values are different. And how does chrome calculate the width as 769px?
Any comments are welcome. :)
Michael Hulet47,911 Points
When you change the width/height of the window with Chrome's developer tools open, it shows you the viewport width and the viewport height in the format
WIDTHxHEIGHT. If the
body of your page is less than that, you can set it to be so by adding one of these blocks to your CSS:
height: 1vh; /* vh is a unit that is relative to the viewport's height */
width: 1vw; /* vw is a unit that is relative to the viewport's width */
The only real difference between the above snippets is that the second one uses a newer feature of CSS, so it won't be supported on many older browsers. If you care about support for older browsers, you should go with the first snippet