Mobile Web development best to use REM units, and then set the following JS, to Iphone6 750*1334 as the benchmark
<script>varsize = document.documentelement.clientwidth/750 * 100; //PC-side interview, viewport if(!/android|webos|iphone|ipod| blackberry/i.test (navigator.useragent)) {Size= 100; } document.documentElement.style.fontSize= size + ' px '; //troubleshoot iOS safari disable scaling invalid problemWindow.onload =function() {Document.addeventlistener (' Gesturestart ',function(e) {e.preventdefault (); }); Document.addeventlistener (' DblClick ',function(e) {e.preventdefault (); }); Document.addeventlistener (' Touchstart ',function(event) {if(Event.touches.length > 1) {event.preventdefault (); } }); varLasttouchend = 0; Document.addeventlistener (' Touchend ',function(event) {varnow = (NewDate ()). GetTime (); if(Now-lasttouchend <= 300) {event.preventdefault (); } lasttouchend=Now ; }, false); };</script>
Equivalent to setting the font-size:100px in the root HTML element
{ font-size: 100px;}
The font-size of the root HTML will be changed according to the size of the mobile side, thus achieving compatibility with various screen sizes.
{ font-size: . 14rem; //font is set to 14px width: 2rem; Width is set to 200px}
Mobile-side web compatible with a variety of resolution wording