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 Layout Basics Getting Started with CSS Layout Using a Mobile First Approach

media query

If I add a media query of min-width 480px and make its container width to 80% do I have to change it for devices which are more than 480px? or I should add a separate media query for those devices which are more than 480px.

3 Answers

there is a very easy way to understand min and max values. You always keep in mind that Min means minimum and max means maximum so when you add min-width:480px so it means the minimum size of screen 480px.

Below the 480px screen, this rule will be not applied.

Antti Lylander
Antti Lylander
9,686 Points

min-width 480px means that it will be applied to sizes GREATER or equal to 480px.

If I want to make the container width of 80% and padding of 1em on both mobile and desktop devices should I write it only on media query or I should also write it outside the media query?

Antti Lylander
Antti Lylander
9,686 Points

Write it outside and it will be applied to all viewport sizes. Media query is used to change part of styling for certain display size.