I'm new to HTML5 & CSS3 so I'm working on a simple project to learn it better. I recently discovered responsive design so I am creating a page that scales to my phone. I using media queries, I created two states, one for screens 640px (mobile) and smaller and one for screen 641px and bigger (desktop). The site works fine, showing the correct styles on my desktop when I scale the window and showing the correct style when I view it on my phone.
However, after running the site, I decided to check the resolution of my HTC One - it's 1080p. My phone displays the 640px site regardless of orientation. I'm wondering why this happens; the phone's higher resolution shouldn't trigger the mobile state, but it does. I'm thinking I might be confused on how resolutions actually work.
So, how do I determine the true resolution of phones (and tablets) so that I can create appropriately scaled sites for them?
//Mobile
@media screen and (max-width: 640px) {
...
}
//Desktop
@media screen and (min-width: 641px) {
...
}
Edit Thanks to JoshCs comment below, I realized that I had the viewport meta tag in use from a tutorial. I'd like to revise my question to ask: how does the viewport tag determine what resolution to display for any given device (how do I determine the viewported resolution based on the dimensions of a device)?
<meta name="viewport" content="width=device-width; initial-scale=1.0">