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.

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,673 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,673 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.