I have a website that will mainly be used for large screen monitors on the desktop. Within the page I will have various content sections, but I also want to have a mobile ap
I'm only familiar with web apps, so the answer will focus on that.
Screen size related app styling is typically dependent on:
To emulate a mobile device from the perspective of an app, we then can:
element with a width / height set at resolution / devicePixelRatio, so that the width of an iframe will fool the media queries, and custom styling for smaller screens will take effect.This will take care of the app working "right", but the iframe elements will then look quite too big compared to a real mobile device on a typical computer screen.
This is, however, dependend on the resolution and physical size of a the computer screen (and we can't know the physical size or dpi programatically, only guess or make the user measure). This means we will not be able get an "actual size" device on a computer screen, just an educated guess.
To help with the "too big" problem, we can't just resize the iframe, since then the media queries will stop working right. We hence must scale the iframe with a css transform to a more reasonable size. The scaling factor can then be adapted for different computer screen resolutions .
The concept is illustrated in the following jsfiddle: https://codepen.io/Kasparas/pen/mxPOyY
The "App" that the emulators are showing is hosted at: https://kasparasanusauskas.github.io/stackoverflow-demos/demo-app-responsive/index.html
The "App" has a few fixed size boxes and a @media screen and (min-width:360px) media query that makes the background blue on screens larger than 360px. This illustrates the difference of layout and media queries in different screens.