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 Responsive Layouts Media Queries Understanding Breakpoints

Ronny Ewanek
Ronny Ewanek
4,385 Points

The meaning of mobile first approach

Lets say I'm writing CSS to modify a WP theme's template. Should I be writing this CSS under a media breakpoint for, lets say, a phone first? As in ensure it looks good on mobile and then expand?

6 Answers

Yeah this is what you should be doing! A lot of web page views now come from mobile so it is essential that the page looks and performs well on a mobile devices!

If you have any more questions feel free to ask them!

Ronny Ewanek
Ronny Ewanek
4,385 Points

Thanks for your reply! I was updated a CSS file for a site of mine and I noticed that I had to put !important for the tablet breakpoint. Why is that?

No. Mobile First is the idea that your DEFAULT CSS styles are the ones for mobile. All most 60% of all website traffic comes from Mobile these days, and mobile browser are a lot more fragile to bugs and issues so it is very important to make sure your website is mobile first. With Default CSS I mean that your CSS with-no MQ should be the mobile on and then scale up to the desktop. This is great not only for the dev side but also for the design because you don't think in terms of desktop, wich can lead to not-so-good mobile websites.

A mobile first approach is recommended because mobile device are now outpacing views over large format like PCs. By starting with a mobile first approach you can more easily use media queries to reformat your pages to larger devices.

I'm sure it's almost like that.

Ronny Ewanek
Ronny Ewanek
4,385 Points

I discovered that I don't need to use !important if I have all my CSS in media breakpoints :)

Antonio Sarnelli
Antonio Sarnelli
4,546 Points

I to this day when it starts responsive delivery from Max-widht, am I doing wrong then?