CSS CSS Layout Basics CSS Layout Project Introducing the Project

Amandeep Pasricha
Amandeep Pasricha
14,931 Points

Why do I only create two media queries, as opposed to adding a separate one for mobile devices?

If I'm creating a media query for tablets, and then desktops, what I don't get is...how will I know that I will get the desired design for my mobile design? Aren't you supposed to design a separate layout for the mobile media query?

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Amandeep Pasricha ! The "mobile first" approach may seem a little counter-intuitive at first because we do development on computers, right? As late as around 2010 most web browsing was still done on desktops (though I need a more credible source on that). Today over 75% of web browsing happens on mobile devices. What this means is that we used to always assume that the CSS would be displayed on a desktop by default. Today, we assume that it will be displayed on a mobile device by default.

This means that your base CSS should be designed for a mobile phone while your media queries should handle the outliers which in this day and age, are tablets and desktops :smiley:

Hope this helps! :sparkles:

Amandeep Pasricha
Amandeep Pasricha
14,931 Points

Jennifer Nordell Oh okay. So EVERYTHING mobile is base layout code, and everything outside of that is done in media queries, correct?

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Amandeep Pasricha Yup! Sorry. Just got the notification of your response. It's assumed that the main portion of your CSS is designed for mobile :smiley: