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

sunmin yun
sunmin yun
2,880 Points

Media query - Approaching Mobile Websites first ?

Hello my friends, So I was told in this lecture video and few other videos regarding media queries. It makes sense to create mobile size websites first and making your way up. So when ever I work on new projects creating a website, should i need to create a media query first before anything else?

Enea Jorgji
Enea Jorgji
6,038 Points

Mobile first approach - it is about coding with special classes, taking in consideration that the website will look good in different size of screens.

2 Answers

Ryan M
Ryan M
16,203 Points

No. The mobile first approach is simply that all of the styles outside of media queries apply to everything (including mobile) and then min-width media queries are used to add complexity and/or overwrite styles for larger viewport sizes.

This means that mobiles won't even need to load the styles that aren't required for mobile and therefore reduces load time and improves the mobile experience.

Hope this helps :)

sunmin yun
sunmin yun
2,880 Points

Ryan McFarlane Thank you :D Will keep that in mind ! Again, Thanks so much for the reply!!