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 CSS Layout Project Creating and Styling the Layout Containers

Setting base styles for mobile first approach

I'm quite unsure what styles I should be applying to the base layout and what should be applied to the breakpoint in the media query? What thought process can I use that eases this approach?

2 Answers

Meg Matty
.a{fill-rule:evenodd;}techdegree seal-36
Meg Matty
Front End Web Development Techdegree Graduate 22,928 Points

The simplest answer I can try to give without more info, is that you build the styles you need to make the site look the way you want in a mobile viewport, then use the breakpoints to add or change whatever styles are not optimal or "break" the way the site looks in larger sizes. So for example, you may be fine with a basic display:block vertical nav in your initial base styles (mobile) but at the media query decide to change these items to a horizontal layout (inline-block).

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Benjamin,

The simplest rule of the thumb i can offer is that for mobile screens you're looking for a 1 column layout. So elements of your website will stack on top of each other; your header, navigation and content, and of course only essential content is retained which keeps your website nice and simple.

Then, as the screen gets larger the layout starts to break. and in order to keep it looking nice suddenly more content can be introduced. This will then stack side by side.

For stacking elements vertically you'd use display: block For side by side display you'd use display: inline-block