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

Question about responsive design

I'm wondering if anyone has any opinion regarding max vs min widths & heights when talking about responsive design.

Is there a best practice? If so, why?

3 Answers

Hi Paul,

yes I would strongly recommended creating sites mobile first.

I started out by using 'Max-Width' and then scaling down like most people do and I can tell you it will save you a lot of time creating your site mobile first.

So what this actually means is I will begin my site looking at a mobile size in my screen and do that first before building my larger screen sizes.

Just to be clear, this doesn't I mean I don't look at my desktop size layout at all. I do, but when it comes to the styling it's almost always better to start smaller.

Have you ever got to a stage where you got the larger screen size looking good and then tried doing the mobile side and found it an absolute pain? You end up spending hours hacking around to get things just right.

I think what you will find is if you start mobile first the desktop will probably look just about right. I end up using less code aswell.

It can be a hard adjustment at first because you're not used to but it's worth the time drilling it in to your mind to create sites in this order.

I sometimes think why does mobile first to large screen size work so much better than large to small?

I guess when you do the mobile sizing you have to simplify things because it's harder to create complex layouts at smalller screen sizes.

Sometimes creating layouts in a desktop view you can over complicate things and then find at smaller screen sizes it's harder to rectify the situation.

Any more questions please ask!

Joe

Joe speaks the truth, Paul. I learned it the hard way. Don't be me. ;-)

Okay, so I suppose it's just a matter of whether or not you build mobile first. I was actually asking specifically between max or min widths but that makes sense. If you build desktop first you kinda have to use max-widths to scale down.

I appreciate the input :) thanks gentlemen

Hi Paul,

yeah use min-width.

There will be the odd occasion using max-width is the best choice though!