Impact Factor: 1 device Physical pixel 2 scaling 3 DPR
Set the ideal viewport
<meta name= "viewport" content= "width=device-width,initial-scale=1.0" >
Method 1 Fixed height, Width adaptive: Vertical direction with fixed value, horizontal direction percentage, fixed value, Flex line.
Principle:<meta name="viewport" content="width=device-width,initial-scale=1">
Method 2 fixed width, viewport scaling: Viewport width uses a width, the browser automatically completes the zoom, the unit uses PX.
Principle: the need to dynamically generate viewport based on screen width, generated similar<meta name="viewport" content="width=640,initial-scale=0.5,maximum-scale=0.5,minimum-scale=0.5,user-scalable=no">
Method 3 Rem Do width, viewport zoom
Depending on the screen width, the REM value is set, and the element that needs to be adapted uses REM and does not need to be a matching element using PX.
Principle: 1 Dynamically generated viewport, set to 1/DPR 2 screen width set REM size, that is, to HTML settings Font-size 3 based on device pixel than window.devicepixelratio to set DATA-DPT