17

What are the standard width for smartphones and tablets when you code for responsive design. I looked into diffrent websites but I didn't seem to find any good templates for standard width. What do you guys usually do for breakpoint/mediaqueries when coding responsive design?

If anyone has a good template of diffrent resultions for tablet/smartphone etc please share them! Thanks!

2
  • 3
    Avoid device-driven breakpoints; let content & design determine breakpoints.
    – skube
    Commented Nov 30, 2013 at 15:09
  • 1
    I highly agree with @skube. As this article quotes Instead of being concerned with device breakpoints the best practice is to design for your smallest viewport first. As you expand that view there will come a point at which the design looks terrible. This is where you add a break point. Commented May 8, 2021 at 13:32

2 Answers 2

29

There is two way of thinking your CSS media querys.

First one is to go 'Desktop First'. That mean that your base CSS will aim at large screens and then your media query will overwrite your classes to adapt to smaller classes. Your CSS could go like this :

/* Large screens ----------- */
/*some CSS*/

/* Desktops and laptops ----------- */
@media only screen and (max-width : 1824px) {...}

/* iPads (landscape) ----------- */
@media only screen and (max-width : 1224px) {...}

/* iPads (portrait) ----------- */
@media only screen and (max-width : 1024px) {...}

/* Smartphones (landscape) ----------- */
@media only screen and (max-width : 768px) {...}

/* Big smartphones (portrait) (ie: Galaxy 3 has 360)*/
@media only screen and (max-width : 640px) {...}

/* Smartphones (portrait) (ie: Galaxy 1) */
@media only screen and (max-width : 321px) {...}

The second approach is to go 'Mobile First'. That mean that your base CSS will aim at small screens like the IPhone 4. Then your media query will overwrite your classes to adapt to bigger screens. Here's and example :

/* Smartphones (portrait) ----------- */

/* Ipad2 (portrait) ----------- */
@media only screen and (min-width : 768px){...}

/* Ipad2 (paysage) ----------- */
@media only screen and (min-width : 1024px){...}

/* Ordi (Petit) ----------- */
@media only screen and (min-width : 1224px){...}

/* Desktops and laptops ----------- */
@media only screen and (min-width : 1824px){...}

If you really want to go into details and take advantage of the retina display, you will have to play with the pixel ratio. Take a look at this overkill css style sheet : media-queries-boilerplate.css. One of the nice thing to do with the retina display is to provide higher quality images to the client. The downside it that it take more bandwith and make the site slower.

I hope this help you.

1

I always use percentages when coding responsive design elements - avoid using device-driven breakpoints as Skube stated in their comment on your question.

1
  • 7
    Using percentages is great but most of the time you need to set a minimum and a maximum. It's pretty hard to create a website that will look as great on IPhone that it will look on a 1920x1080 monitor. Advanced CSS style sheets will use percentage with breakpoint to allow a really adaptive layout.
    – Gab
    Commented Nov 30, 2013 at 15:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.