Realistic Mobile Screen Resolutions - css

Is there a Matrix anywhere to get realistic screen availability for the most common phones which take into account the screen resolution available with toolbars visible?
We need to develop a scrolling site for mobile/tablet and although we are trying to make the css as fluid as possible the brief relies on background imagery which means we need a variety of media queries to switch the images for the best experience - a realistic resolution guide would be really helpful.
Cheers

In Google Chrome, open developer tools by pressing F12, and click on the gear icon to go to Settings -> Overrides, turn on 'User Agent', and select your desired device - with 'Device Matrix' you can customize screen size and more.

Check out http://screensiz.es/phone .
You can order phones or tablets by screen size, aspect ratio and popularity.
Also check out screencast in chrome canary dev tools.
http://www.html5rocks.com/en/tutorials/developertools/mobile/
What I am still looking for is something like google's browsersize but for mobile screen.
Update:
Google Labs Browser Size is now part of Google Analytics
For up to date datas check https://design.google.com/devices/ (AKA now as https://material.io/tools/devices/)

#media (min-width: 1200px) {
#media (max-width: 980px) {
#media (max-width: 979px) {
#media (min-width: 980px) {
#media (min-width: 768px) and (max-width: 979px){
#media (max-width: 768px) {
#media (max-width: 767px) {
#media (max-width: 480px) {
Should be the standards

I think you should definitely try this website : http://responsivetools.com/
It will give you a quick idea of how you site looks like for different mobile and tablet resolution.

There are many online services where you can view you site "through" a phone's display, with the resolutions specified.
For example: mobilephoneemulator

Statcounter probably provides the best number crunching on screen sizes and many other stats. Their page always gives me loading problems, so I prefer to find someone that has quoted their stats, than going directly to the source, like this blogger:
http://www.satya-weblog.com/2013/07/desktop-laptop-mobile-screen-resolution-most-common-worldwide.html
Hope that is a more direct answer to your question!

We'll you might want to try going here: http://cartoonized.net/cellphone-screen-resolution.php it basically gives you the best resolution depending on types of phones.

This is a list for all known CSS #media property for mobile devices + several desktop resolution that can be used.
These include Android, iPhone, iPad, Google Nexus, LG, Samsung, Nokia, HTC, Motorola, Sony and all the famous brands.
Look on GitHub
#media all and (max-width: 2560px){
}
#media all and (max-width: 1920px){
}
#media all and (max-width: 1440px){
}
#media all and (max-width: 1280px){
}
#media all and (max-width: 1200px){
}
#media all and (max-width: 1024px){
}
#media all and (max-width: 992px){
}
#media all and (max-width: 768px){
}
#media all and (max-width: 720px){
}
#media all and (max-width: 600px){
}
#media all and (max-width: 540px){
}
#media all and (max-width: 480px){
}
#media all and (max-width: 424px){
}
#media all and (max-width: 414px){
}
#media all and (max-width: 400px){
}
#media all and (max-width: 384px){
}
#media all and (max-width: 375px){
}
#media all and (max-width: 360px){
}
#media all and (max-width: 320px){
}

Related

#media queries confusion - proper approach

Hi guys I was always using a simple media queries scaffold but this time round I'm trying a bit more complex approach. Of course I'm trying to write as much stuff on grid and flexbox, but we all know that websites needs media queries.
So the problem I'm facing is that if I use the below approach I'm forced to set every breaking point in order to achieve the responsive web design.
mobile -> #media (max-width: 767px)
tablet -> #media (min-width: 768px) and (max-width: 1024px)
laptop-small -> #media (min-width: 1025px) and (max-width: 1349px)
laptop -> #media (min-width: 1350px) and (max-width: 1549px)
desktop-small -> #media (min-width: 1550px) and (max-width: 1679px)
desktop -> #media (min-width: 1680px)
Now when I use this method below I was expecting that I can use any of the predefined breaking points and if the breaking point is not set, browser will use any closest one which is set.
But in practice they overlapping each other :(
mobile -> #media (max-width: 767px)
tablet -> #media (max-width: 1024px)
laptop-small -> #media (max-width: 1349px)
laptop -> #media (max-width: 1549px)
desktop-small -> #media (max-width: 1679px)
desktop -> #media (min-width: 1680px)
And the third one is working exactly the same as the second one but other way round, and queries are also overlapping each other.
mobile -> #media (max-width: 767px)
tablet -> #media (min-width: 768px)
laptop-small -> #media (min-width: 1024px)
laptop -> #media (min-width: 1349px)
desktop-small -> #media (min-width: 1549px)
desktop -> #media (min-width: 1680px)
So what I'm doing wrong? The first approach works for me but there is so much hassle to set every element to those breaking points and I think there must be another way. I would like to have a proper media query scaffold and use any breaking point I need so for example first middle one and last one if there is such a need on my design.
I just need some suggestions or hints guys.Thanks!
Edit: 28/05/2022
So, this looks like mobile first approach because all outside or below <768px is designated for mobile.
#media (min-width: 768px)
#media (min-width: 1025px)
#media (min-width: 1350px)
#media (min-width: 1550px)
#media (min-width: 1680px)
#media (min-width: 2000px)
Do I'm right here?

Easiest way to create media queries for multiple devices

I am doing updates to my personal website and giving it a completely new layout. I have been working with SASS and converting it to CSS. I want my site to display on any device that the user might be using (i.e laptop, iPad, mobile phone). Currently, I have been writing my SASS/CSS using media queries to target each different device. As there are so many different to deceives, I was wondering if there is an easier way to write style for each device without having to target them individually?
#media screen and (width: 375px) and (orientation: portrait) {
button,
#submit,
a.button {
font-size: 18px;
width: 200px;
height: 50px;
}
}
#media screen and (max-width: 414px) and (orientation: portrait) {
button,
#submit,
a.button {
font-size: 18px;
width: 200px;
height: 50px;
}
}
These media quires might help you
// Extra small devices (portrait phones, less than 576px)
// No media query since this is the default in Bootstrap
// Small devices (landscape phones, 576px and up)
#media (min-width: 576px) { ... }
// Medium devices (tablets, 768px and up)
#media (min-width: 768px) { ... }
// Large devices (desktops, 992px and up)
#media (min-width: 992px) { ... }
// Extra large devices (large desktops, 1200px and up)
#media (min-width: 1200px) { ... }
A good approach to writing CSS is to use the mobile first principle. It means you start off from the smallest screen and work your way up. This means that your cascade (the C part of CSS) works to it's fullest potential. After you have small, medium and large looking good, start to work on the "weirder" sizes.
For example, mobile landscape size:
#media only screen and (min-device-width: 320px) and (max-device-width: 812px) and (orientation: landscape) {
code goes here
}
This should make everything more manageable.
Here is my media queries that support major multiple devices.
Supported Devices: Moto G4, Galaxy S5, Pixel 2, Pixel 2 XL, iPhone 5/SE, iPhone 6/7/8, iPhone 6/7/8 Plus, iPhone X, iPad, iPad Pro, Surface Duo, Galaxy Duo
`#media only screen and (max-width: 280px){
}
#media only screen and (min-width: 281px) and (max-width: 320px){
}
#media only screen and (min-width: 321px) and (max-width: 360px){
}
#media only screen and (min-width: 361px) and (max-width: 500px){
}
#media only screen and (min-width: 501px) and (max-width: 800px){
}
#media only screen and (min-width: 801px) {
}`

how do I make two different media queries for mobile and website

I'm using the below media queries for website. As and when the window is expanded and contracted, it works fine. But for mobile phone, although on chrome dev tool's cell phone simulator, the layout looks perfect. But this same media queries breaks on my actual mobile phone(despite having the same design/layout for both mobile and web). How can I make two different media queries?
#media only screen and (min-width: 10px) and (max-width: 319px) {
}
#media only screen and (min-width: 320px) {
}
#media screen and (min-width: 481px) {
}
#media screen and (min-width: 641px) {
}
#media screen and (min-width: 768px) {
}
#media screen and (min-width: 961px) {
}
edit: iphone 6.
The reason I have so many break pints is because I'm using background image. When window size is made small, the image(with no background repeat) shows blank space at the bottom. To counter that problem, had to go with many breakpoints.
Use max-width instead of min-width. Because i think all your media query represent when the screen resolution bigger than 320 678 etc and due to that only desktop query execute.

css only for desktop or laptops but not for ipad browsers

How can I apply the css only for desktops and laptops browser excluding ipad and mobile browsers?
#media only screen and (min-width: 742px) and (max-width: 769px){
#element{
display: none;
}
}
How can you guarantee a user isn't going to view your site/webapp on a desktop device that falls into the viewport width you have stated? You can't.
If really need to be that specific, device specific as apposed to using viewport width, you can sniff the browser I guess.
Here is a quick jquery demo here using:
navigator.userAgent
http://jsfiddle.net/y3ds0xpv/ - note: you'll need to view on a mobile device to see the difference between desktop and mobile.
Ultimately, I'd recommend using this if you need to use this method:
http://detector.dmolsen.com/
You could always do it like this (modified from here):
#media not all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait) {
#element{ display: none; } /* your css rules for ipad portrait */
}
#media not all and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape) {
#element{ display: none; } /* your css rules for ipad landscape */
}
I'm sure you have a valid reason for doing this but I'd be careful. As a rule you should detect features, not devices.
A media query to target iPads (portrait and landscape) would be:
#media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { }
so to avoid targeting iPads you can just reverse that and get everything larger and everything smaller..
#media only screen and (max-device-width:768px),(min-device-width:1024px) { }
#media only screen and (max-width: 769px){
#element{
display: none;
}
}
#media screen and (min-width:1000px){
#element{display:none;}
}
Using Foundation framework you will have options for all screen sizes be it desktops, tablets or phones. Using their 'large', 'medium' and 'small' functions. It is fairly easy to use.
With Foundation your problem would be fixed by just adding hide-for-small and hide-for-medium classes to the div being displayed only on desktop.
Finally, I got working media query only for desktops or laptops browser:
#media only screen and (min-width: 742px) and (max-width: 769px),
not all and (min-width: 742px) and (max-width: 769px) (orientation: portrait){
#element{
display: none;
}
}
Glad to say, it is working nice.

media queries for desktop 1024 vs ipad

I need to set my site on desktop (1024 * 768) and ipad, but I can not separate his Vizualization.
I'm using in Ipad:
# media only screen and (min-device-width: 768px) and (max-device-width : 1010px)
and desktop:
# media (min-width: 1020px)
its Works in Firefox, but not Chrome.
Rather than trying to target specific devices, it's arguably better to set appropriate breakpoints specific to your layout. That is, gradually narrow your browser and observe the points at which this particular design needs to reflow. Then set styles that apply to those points, and let each device receive whatever layout works best within its dimensions.
So, in the head of your page, I recommend you place this:
<meta name="viewport" content="width=device-width">
and then in your style sheet, use something like this (the numbers are arbitrary):
/* default styles, perhaps for basic mobiles and older browsers */
/* end default styles */
#media only screen and (min-width: 1025px) { }
#media only screen and (min-width: 701px) and (max-width: 1024px) { }
#media only screen and (max-width: 700px) { }
#media only screen and (min-width: 320px) and (max-width: 480px) { }
There are so many combinations of this that the above is just a rough example. You don't always need max and/or min. It depends on the layout.
There's also an argument for using ems instead of px, but I won't go there for now. :)
Why not just cascade down?
#media screen and (max-width : 1024px){ /*Styles*/ }
#media screen and (max-device-width : 768px){ /*Styles*/ }
1024x768 is iPad size anyway.

Resources