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

Max S.
Max S.
4,656 Points

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