Simulating mobile resolution in a section of a webpage

前端 未结 6 1083
迷失自我
迷失自我 2020-12-29 21:20

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

6条回答
  •  再見小時候
    2020-12-29 21:41

    I'm only familiar with web apps, so the answer will focus on that.

    Screen size related app styling is typically dependent on:

    1. The width / height ratio of device.
    2. Screen width / height reported by the device due to styling properties set in media queries or via javascript. Note that on mobile devices, typically this is not the actual resolution, but the resolution divided by what is called "devicePixelRatio".

    To emulate a mobile device from the perspective of an app, we then can:

    1. Set the ratio of a container to the ratio of a certain mobile device. This will move / resize the elements of an app just the same way as resizing a window will, or, just as a small screen of a mobile would.
    2. Load the app in an