• I’ve been learning about media queries and see web pages showing examples of their use.

    The container for my WP site is 960 wide and I am concerned with controlling styling on tablets and smartphones.

    I think I understand the basics, but how do I determine what devices or sizes to target for current times?

    For instance, one popular reference is https://css-tricks.com/snippets/css/media-queries-for-standard-devices/ but it’s four years old and much has changed in that time.

    Is there a reference that shows what devices and/or sizes my media queries should include?

    I’m not sure I made my question clear, so please bear with me.

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t think you should be using standard breakpoints (480, 768, 960, 1024, etc.), but you should open your site in a browser, and resize it smaller/larger to see where your design “breaks”

    I just wrote a long post about this on another forum, so I’ll quote (Warning! Long story ahead).

    In my opinion, the breakpoint totally depends on the design in question. You should set your breakpoints where your design actually “breaks”. This can be at 1024 wide, but maybe it’s at 1211, or maybe at 1371, or maybe at 934? Resize your browser window and notice where something starts looking wrong.

    Make sure everything looks good at every single width. Sometimes this takes one breakpoint, sometimes a bit more.

    That way, you’ll be all set when a new device comes out that happens to have a weird random resolution, like 1290 x 723.

    Here’s a very random example. Let’s say this is your design for a menu: https://codepen.io/senff/full/JaxvL
    Currently there is a breakpoint set at 568px, which is a “common” breakpoint (seeing that is the iPhone 5 landscape width), so once the screen width is smaller than 568, the menu will look different and optimized for mobile.

    But, actually try resizing the window and you’ll see that the layout already breaks around 600 pixels: if the window gets any smaller than that, the last item wraps. Make it even smaller, and you’ll get your mobile menu at 568 width. But…yeah, there’s this zone between 568 and 600 where the menu just doesn’t look good.

    You might think “yeah but on iPhone it will look good because that’s 568, so that breakpoint will be applied fine“. Thing is, what if the next device you’re using has a screen width of 590? Not all devices are the same resolution as the iPhone.

    It’s a very extreme example, but it shows why “common” breakpoints shouldn’t be used blindly. In this very case, I would set the breakpoint at 620 — always a little higher than where it breaks. That way, it will always look good, whether it’s below 568, or above 620, or anything in between.

    Thread Starter ruauu2

    (@ruauu2)

    Hi Senff,

    Good explanation…

    Can I use my desktop browser window to accurately replicate layout behavior of tablet and mobile sizes?

    And, what is the smallest screen size I should be concerned with?

    Thank you for your help!

    You can/should use your desktop browser to replicate layout behaviour basics. This will only replicate screen size though, and there’s more to responsive design than just that: you can also work with orientation (landscape/portrait) and pixel density (retina screens). But in general, workng with just the screen size is sufficient and so for that you can use your browser and reize it, or use one of the many screen size emulators/viewport resizers out there (for example: https://lab.maltewassermann.com/viewport-resizer/ ).

    As for the minimum size: I’d say 320 is the minimum. However, who knows what resolution Apple’s next revolutionary invention will have? That could be 240 or 200 for all we know….. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Media queries: How to determine which sizes to target?’ is closed to new replies.