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

Mobile First Question

Hi everybody,

So, generally mobile versions are simpler than the desktop ones. If I first design the mobile version, ¿how do I add content for the tablet and desktop versions? do I have to write all the html and then set the things I don't want on mobile to display: none ? What is the best way to approach this?

Thanks!

Bootstrap is taught in Framework Basics and has a section for media queries.

Use media queries to target specific breakpoints and reveal content as you scale up. You can accomplish that by using display: none and display: block at those breakpoints. It's generally not a good idea to target a specific device like an iPad but instead add breakpoints where your layout starts to, well, break.

1 Answer

Yes, my approach has always been mobile first. 1.) Think about what content my users don't really need when viewing on mobile, only show them the most important content. 2.) Increase browser width until stuff starts to look awkward, add a breakpoint. 3.) Adjust styles to prevent awkwardness for new breakpoint and add additional content.